Click to See Complete Forum and Search --> : Is there any way to pause a console program?
Wynd
Dec 24th, 2000, 05:19 PM
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?
#include <conio.h>
#include <iostream.h>
int main()
{
//do stuff here.
//end of program
cout << "Press any key to continue";
getch();
return 0;
}
Vlatko
Dec 25th, 2000, 12:02 PM
At the very end of your main() function, put:
#include <stdlib.h>
....
system("pause");
return 0;
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.