fork download
  1. #include <iostream>
  2. #include <limits>
  3. using namespace std;
  4.  
  5. int main() { int nr = 0;
  6. while (!(std::cin >> nr)) {
  7. std::cin.clear();
  8. std::cin.ignore(std::numeric_limits<int>::max(), '\n');
  9. std::cout << "Input is not number , try one more time: ";
  10. }
  11.  
  12. std::cout << "Vector length: " << nr << std::endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 3344KB
stdin
6.9
stdout
Vector length: 6