Guest User

Untitled

a guest
Sep 28th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include<iostream>
  2. #include<limits>
  3. using namespace std;
  4. int main()
  5. {
  6.  
  7. cout << "Enter an int: ";
  8. int x = 0;
  9. while(!(cin >> x)){
  10. cin.clear();
  11. cin.ignore(numeric_limits<streamsize>::max(), '\n');
  12. cout << "Invalid input. Try again: ";
  13. }
  14. cout << "You enterd: " << x << endl;
  15. }
Add Comment
Please, Sign In to add comment