22 lines
391 B
C++
22 lines
391 B
C++
|
#include <iostream>
|
||
|
using namespace std;
|
||
|
|
||
|
/*
|
||
|
what happens if you enter a character? what happens if I enter 12.2?
|
||
|
how do I abstract this?
|
||
|
*/
|
||
|
|
||
|
int main() {
|
||
|
int ourInput;
|
||
|
|
||
|
cout << "Enter a whole number, only." << endl;
|
||
|
cin >> ourInput;
|
||
|
while(cin.fail()){
|
||
|
cout << "Nope, enter a number" << endl;
|
||
|
cin.clear();
|
||
|
cin.ignore(256,'\n');
|
||
|
cin >> ourInput;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|