this snippet of code is an alternative to system(“pause”) in MS Visual Studio.

/*
* File:   SystemPause.cpp
* Author: B Turley
*
* This function can be used as a substitute for 'system("pause")'
* in Microsoft Visual Studio
*
* Created on November 10, 2009, 1:17 AM
*/

#include <iostream>
#include <limits>
using namespace std;

void pause()
{
cout<<"Press any key to Continue...";
cin.sync();
cin.ignore(numeric_limits<streamsize> ::max(), 'n');
}

int main(int argc, char** argv) {

pause();

return (0);
}

Leave a Reply

Your email address will not be published.