Reputation: 77
when i run this code mentioned below, The output console appears for fraction of second and then disappear, but every thing is fine in this code.there is no compile error or warning. i also use get character function but same issue. i am using dev-c++ 4.9.9.2 version on win 7, 32 bits. what to do?
#include <iostream>
using namespace std;
int main ()
{
cout<<"welcm";
return 0;
}
Upvotes: 1
Views: 481
Reputation: 1863
You can use cin.get()
before your return statement to avoid the console window from closing.
Upvotes: 2
Reputation: 8986
You need to tell the program to wait before closing.
cout<<"welcm";
system("pause"); // add this line
return 0;
Upvotes: 1