For example, at the end of a program it says "Press any key to continue", but you can't really see any output because it closes too fast. Is it possible to have the program wait for a keypress before proceeding?
Printable View
For example, at the end of a program it says "Press any key to continue", but you can't really see any output because it closes too fast. Is it possible to have the program wait for a keypress before proceeding?
Code:#include <conio.h>
#include <iostream.h>
int main()
{
//do stuff here.
//end of program
cout << "Press any key to continue";
getch();
return 0;
}
At the very end of your main() function, put:
Code:#include <stdlib.h>
....
system("pause");
return 0;