TelMeDragon
Feb 16 2008, 01:43 AM
Ok well I decided to learn C++, and after doing a "Hello World" Basic run-through (and an attempt at a fahreneit to Celsius converter). I have failed miserably.
The converter didn't work because of some errors, I'm not sure where, i copied it straight off the book i bought.
The hello world didn't work because the program won't run. I compiled it and found the .exe and double clicked it but all that pops up is a command prompt for a second and then it disappears with ntohing else.
I am using Dev-C++
Does anyone know what's wrong?
tswsl1989
Feb 16 2008, 07:27 AM
The hellow world one sounds like it's worked.
Try opening a command prompt, then running the hello world program from there.
C++ examples can often (even though they shouldn't) be compiler specific.
Try searching the net for Dev-C++ Tutorials\examples.
From another C++ learner, I hope that helps,
groovicus
Feb 16 2008, 08:33 AM
C++ is not compiler specific.
However, tswsl1989 is correct that the program probably ran fine. If the command window opened and closed, then it worked. It only takes about a tenth of a second to run a "hello world" program. As was stated, drop to a command line prompt, and execute your code from there.
TelMeDragon
Feb 16 2008, 12:54 PM
Ok thank you for your replies, and I have found my problem after digging through various codes from tutorials. Thank you once again
danbrownlow
Feb 22 2008, 08:53 AM
Also, when learning I realised (I'm english.. I'm not spelling wrong

) that before returning, if you type System("pause"); then it would halt the program so you could actually see what was happening =]
Dan
Deemo Diablo
Mar 23 2008, 05:38 AM
If it's not too late I would like to add that entering:
char response;
std::cin >> response;
before return 0; would let you see the results of your program by closing the program only when a random character is pressed followed by the enter key upon completion of said program.
Billy O'Neal
Mar 26 2008, 09:08 PM
QUOTE(Deemo Diablo @ Mar 23 2008, 06:38 AM)

If it's not too late I would like to add that entering:
char response;
std::cin >> response;
before return 0; would let you see the results of your program by closing the program only when a random character is pressed followed by the enter key upon completion of said program.
Careful! Dont want buffer overruns, now do we?
Billy3
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.