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?
Page 1 of 1
C++ Problem It won't run
#2
Posted 16 February 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,
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,
Tom
Tswsl1989
Duct tape is like the force. It has a light side, a dark side, and it holds the universe together
Tswsl1989
Duct tape is like the force. It has a light side, a dark side, and it holds the universe together
#3
Posted 16 February 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.
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.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens
#4
Posted 16 February 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
#5
Posted 22 February 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
Dan
#6
Posted 23 March 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.
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.
This post has been edited by Deemo Diablo: 23 March 2008 - 05:41 AM
#7
Posted 26 March 2008 - 09:08 PM
Deemo Diablo, on Mar 23 2008, 06:38 AM, said:
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.
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
Share this topic:
Page 1 of 1

Help



Back to top











