I never thought I’d say this…
Publicado el 8 March 2012
Archivado en General | Salir del comentario
I got to stop thinking now though, I have to sleep.
Lab 1 results
Publicado el 25 February 2012
Archivado en General | Salir del comentario
Lab 2
Publicado el 25 February 2012
Archivado en General | Salir del comentario
Yes! Found a debugger for Windows!
Publicado el 20 February 2012
Archivado en General | Salir del comentario
Bummer!!! I thought I had it right!
Publicado el 20 February 2012
Archivado en General | Salir del comentario
Note to self: when g++ compiles stuff, at least in what just happened, when there's an int divided by a double variable it results in an int variable. At least that's what happens here in Windows. It screwed up my Moore's Law source code. Bummer. Got check the g++ of Linux though. I really don't know if the compilers work exactly the same, but it seems pretty well like it.
Update: Yeah, it's the same stuff in Linux. I can still compile happily in Windows. I'm so glad that hasn't been taken away from me.
Update: Yeah, it's the same stuff in Linux. I can still compile happily in Windows. I'm so glad that hasn't been taken away from me.
Testing code for the Babylonian Algorithm
Publicado el 20 February 2012
Archivado en General | Salir del comentario
So, I searched in Google how to compute it in C++ and I found that I had to include a new source code called "cmath". I tried it and it worked. Here's the source code for testing the sqrt() function from the cmath source code:
Source Code:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
long double number_to_calculate_square_root_of;
char ans;
cout << endl;
cout << "Greetings.\n";
do
{
cout << "Please enter the number you would like\n";
cout << "to calculate the square root of: ";
cin >> number_to_calculate_square_root_of;
cout << "The square root of that number is: " << sqrt(number_to_calculate_square_root_of) << ".\n";
cout << endl;
cout << "Would you like to repeate this process again?";
cout << "Press 'Y' for yes and 'N' for no:";
}while(ans == 'y' || ans == 'Y');
cout << endl;
cout << "Thank you for testing.";
return 0;
}
PS: I'm definitely going to use this for the Babylonian Algorithm just to check that the algorithm is actually approaching the square root of the inputted number.
PPS: My professor did mention this, but he told me he did...
Note to self: Pay MORE attention.
Batch File and Linux Script – Final Version
Publicado el 19 February 2012
Archivado en General | Salir del comentario
Batch File:
@echo off
echo Compiling and linking C++ source code,
echo and preparing the executable for debugging...
g++.exe -Wall -g -o executable SourceCode.cpp
echo Done
Linux Script:
echo "Compiling and linking C++ source code,"
echo "and preparing the executable for debugging..."
g++ -Wall -g -o executable SourceCode.cpp
echo "Done"PS: I really like their similarities. They are almost the same!
PPS: I got to remember to look for a debugger for the Windows OS later.
MinGW – The Solution! Windows Batch – Updated!
Publicado el 19 February 2012
Archivado en General | Salir del comentario
@echo off
echo "Compiling and linking C++ source code,"
echo "and preparing the executable for debugging..."
"C:\MinGW\bin\g++.exe" -Wall -g -o executable SourceCode.cpp
echo "Done"
PS: I can't believe it! No more jumping between operating systems! Now I'm just missing a debugger! I hate Emacs!
PSS: Before I totally forget. By installing MinGW in windows I had to add a new path for the environment variables. (In Windows 7 I can find that by clicking on Start > Right clicking on Computer > Properties > Advanced System Setting > Environment Variables. Then, once I found the "Path" variable, I had only to add a semi-colon at the end of the line ";" and add the desire path, which in this case was "C:\MinGW\bin". I did this because I had an error with libgmp-10.dll. The g++ from the MinGW directory could not find it when I tried to compile my source code. And now that I recall... setting that environment variable that allows me to run g++ directly through the command prompt window, without having to specify its directory. I should update this *.bat file once more.
Windows Batch File – Done!
Publicado el 19 February 2012
Archivado en General | Salir del comentario
@echo off
echo "Compiling and linking C++ source code..."
"C:\Dev-Cpp\bin\g++.exe" -o executable SourceCode.cpp
echo "Done"Note: It's basically the same stuff as in linux, the only difference is that I need to turn the echo off for the currently running codes. If I don't do this, the line "C:\Dev-Cpp\bin\g++.exe" -o executable SourceCode.cpp will show up in the command prompt window.
PS: It doesn't seem possible to prepare the executable for debugging in Windows. I just read something about MinGW, got to check it out... It's a pain to have to reboot every time I need to make programs.
I can compile in Windows!
Publicado el 19 February 2012
Archivado en General | Salir del comentario
Now I just need to make a script... I'm still too lazy to keep writing the same commands all over again in Windows. « volver — sige buscando »