I need something like system("pause") except lets me put my own message

I want to freeze the program(until the user presses a key) and I want to put my own message instead of

"Press any key to continue..."
1
2
3
int exit;
cout << "My message :P" << endl;
cin >> exit;
 
std::cin.ignore();//my suggestion 

is you want the full code do
1
2
3
4
void exit(){
std::cout << "Press any key t continue...";
std::cin.ignore();
}

this is a little more memory efficient than what shinigami suggested because there is no variable allocation. but both work perfectly well.
Last edited on
Topic archived. No new replies allowed.