×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: C++
Posted by: Bassel Abd El-Kareem
Added: Sep 25, 2015 12:58 PM
Views: 16
GetInteger with Error Handling
  1. int getInt()
  2. {
  3.     while(!(cin >> t)) {
  4.         cin.clear();
  5.         cin.ignore(numeric_limits<streamsize>::max(), '\n');
  6.     }
  7.     return (t);
  8. }