76 89 150 135 200 76 12 100 150 28 178 189 167 200 175 150 87 99 129
149 176 200 87 35 157 189
Tuesday, July 21, 2015
Wednesday, July 15, 2015
#include
using namespace std;
//cin demo with exception detection and quit
int main(void)
{
int n = 0;
char c;
while(cin)
{
cout << "Enter a int(q to quit): ";
cin >> n;
if(!cin)
{
cin.clear();
c=cin.peek();
if(c=='q')
break;
else
{
cout << "Oops try again\n";
cin.ignore(5000,'\n');
}
}
}
return 0;
}
using namespace std;
//cin demo with exception detection and quit
int main(void)
{
int n = 0;
char c;
while(cin)
{
cout << "Enter a int(q to quit): ";
cin >> n;
if(!cin)
{
cin.clear();
c=cin.peek();
if(c=='q')
break;
else
{
cout << "Oops try again\n";
cin.ignore(5000,'\n');
}
}
}
return 0;
}
Subscribe to:
Posts (Atom)