Hello , i am new to programming. How can i stop my executed code as below from disappearing .It appears my compiler is too fast.It compiles ok but the black output plan appears and disappears immediately when executed
#include <iostream>
using namespace std;
int main()
{ cout << "Hello World!";
return 0;
}
|
Go4Expert Founder
|
![]() |
| 28Apr2010,08:59 | #2 |
|
Moved to C-C++ forum
|
|
~ Б0ЯИ Τ0 С0δЭ ~
|
![]() |
| 28Apr2010,09:02 | #3 |
|
Hi !
Welcome to G4EF ![]() Change your code to something like : Code: CPP
Your code basically prints "Hello World!" and then exits, so you fail to see the output. If you instruct it to wait for a key-stroke before exiting (getchar ()), you can have your output on screen, till you press a key. |
|
Pro contributor
|
![]() |
| 28Apr2010,22:47 | #4 |
|
Quote:
Originally Posted by SaswatPadhi its getchar(); you forgot the ;
SaswatPadhi
like this
|
|
~ Б0ЯИ Τ0 С0δЭ ~
|
![]() |
| 29Apr2010,09:20 | #5 |
|
Yeah ..
![]() Thanx virxen, for pointing out ! |
|
Go4Expert Member
|
|
| 29Apr2010,11:46 | #6 |
|
Put a breakpoint at return 0 line / getch line.
U'll see can output. |





