Output Screen didn't stop

0 Muhammad Abubakar · February 19, 2015
I'm newbie My question is Whenever i run my program input screen didn't stop and disappear instantly .
I have tried getch(); and cin.get(); but same result
can anyone please guide me?

Post a Reply


Oldest  Newest  Rating
0 Abdullah Nauman · February 19, 2015
OK, so what i usually do is ask the user if he wants to exit. This stops the screen from closing automaticly. 

Here is how you would achieve that. 

int main() {

       cout << "Hello World" << endl;

string exit;
//Ask User
cout << "Would You Like To Exit?(Y/N)" << endl;
// Get Input
cin << exit;
// Validate Input
if(exit == "y"){

return 0; // Shutdown

if(exit == "n") {

main(); // run main again


Hope I helped. My C+ is a little rusty, so if you find any errors in this let me know. :) 
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator