I typed this:
// my first program in C++
#include %26lt;iostream%26gt;
using namespace std;
int main ()
{
cout %26lt;%26lt; "Hello World!";
cout %26lt;%26lt; "I am a C++ Program!";
return 0;
}
Then i clicked execute and drop menu appeared i clicked compile and then i clicked run it appeared as command prompt and it flashes up fot about 20 milliseconds and then just closed so why is that and is there a way of making the command prompt windows stay up forever until you click close???
Dev-C++ problem or not sure!?
#include %26lt;iostream%26gt;
#include%26lt;conio%26gt;//add this line and the other at last
using namespace std;
int main ()
{
cout %26lt;%26lt; "Hello World!";
cout %26lt;%26lt; "I am a C++ Program!";
getch();//add these two lines
return 0;
}
Reply:Hi
The program is running so fast that it you cant see it.
Type
System ("Pause"); before your return 0; and the screen will stay there for you to see :)
Im learning this too mate but i knew this answer :)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment