26 lines
453 B
C++
26 lines
453 B
C++
|
#include <iostream>
|
||
|
using namespace std;
|
||
|
|
||
|
int main(){
|
||
|
int num1 = 0;
|
||
|
int num2 = 0;
|
||
|
string theRest;
|
||
|
|
||
|
cout << "Enter an integer" << endl;
|
||
|
cin >> num1;
|
||
|
|
||
|
if(!cin.fail()){
|
||
|
cout << "You entered: " << num1 << endl;
|
||
|
}
|
||
|
else {
|
||
|
cin.clear();
|
||
|
cin >> theRest;
|
||
|
cout << "You entered: " << theRest << endl;
|
||
|
}
|
||
|
/*
|
||
|
cout << "Enter another integer" << endl;
|
||
|
cin >> num2;
|
||
|
cout << "You also entered: " << num2 << endl;
|
||
|
*/
|
||
|
return 0;
|
||
|
}
|