Help - Search - Members - Calendar
Full Version: C++ Problem
BleepingComputer.com > Software > Programming
   
TelMeDragon
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
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
C++ is not compiler specific. smile.gif

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
Ok thank you for your replies, and I have found my problem after digging through various codes from tutorials. Thank you once again
danbrownlow
Also, when learning I realised (I'm english.. I'm not spelling wrong tongue.gif) 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
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
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.
Invision Power Board © 2001-2008 Invision Power Services, Inc.