#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 :)
#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 :)
You can go to Start->Run, type cmd
, cd
to the project binary directory, then enter your executable name.
add this getch() or getchar() before return and the consolw window will stay till you enter something
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