#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
开发者_运维问答
This code works, but it run then close windows immediately. Need a fix :)
add this getch() or getchar() before return and the consolw window will stay till you enter something
You can go to Start->Run, type cmd
, cd
to the project binary directory, then enter your executable name.
Enable the 'Run in Terminal' Qt Creator project setting.
I don't know how QT Creators works but you could try.
Add:
char x;
cin>>x;
You'll have to type a letter and press enter to exit.
Or
#include<widows.h>
....
....
system("pause");
return 0;
}
OR
#include<stdlib.h>
....
....
cin.get();
return 0;
}
If you are just interested in viewing the output, it is shown in application output section of Qt Creator
You could declare a breakpoint at return 0; and run in debug.
精彩评论