Can someone PLEASE show me how to accept only integer input from the user?
I have tried this...
int intVersion = atoi(s.c_str());
cout << "Enter the Fibonacci number to compute: " << endl;
cin >> s;
if (intVersion == 0)
cout << "Not an integer\n";
cout << "Is an integer\n";
cout << intVersion;
}while(intVersion == 0);
But even when I enter 1 it says its not an integer. How do I do this?