fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main () {
  4. int N;
  5. cout << " Input an integer:";
  6. if(!(cin >> N)) {
  7. cout << "Input a valid number!" << endl;
  8. cout << "N = " << N << endl;
  9. }
  10. else {
  11. cout << " The integer entered is:" << N << endl;
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0s 3344KB
stdin
hello
stdout
 Input an integer:Input a valid number!
N = 0