| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Small problem probably...
Okay, so I literally JUST got into C++ programming, and I'm using Dev C++... I'm using a tutorial/guide thing to help me learn, and I create this console script that's just supposed to say "Hello world! I am a C++ program!" Well that's all fine... I compile it- no errors. But, when I run it, the thing comes up for like a millisecond and just vanishes. Does anyone know why this would be happening?
This is a copy of the script I used... // my first program in C++ #include <iostream> using namespace std; int main () { cout << "Hello World!"; cout << "I'm a C++ program!"; return 0; } Any help would be appreciated. |
|
#2
|
|||
|
|||
|
Start - Run - cmd
then go to the dir where is your program stored and run it. (just type the name of the compiled exe file) |
|
#3
|
|||
|
|||
|
Or add
system("PAUSE"); |
|
#4
|
|||
|
|||
|
Thanks for the help, guys. Actually what I did was at the end of the code, I just put "cin.get();" As you all probably already know, that makes you push the Enter button before the program will finish.
|
|
#5
|
|||
|
|||
|
Quote:
as does Code:
system("PAUSE");
|
|
#6
|
|||
|
|||
|
Usually, there is an option in the IDE (most people use IDEs nowadays; MS Visual *, Eclipse, KDevelop, CodeBlocks) somewhere to make the window stay up.
The described methods are pretty much just workarounds for not turning that option on. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Small problem probably... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|