Why if I input any letter does my code then say that it belongs in the interval -1, 1 instead of moving to the else clause and printing the error message?
#include <iostream>
using namespace std;
int main()
{
double x ;
cout << "Enter a real number : " ;
cin >> x ;
if ((x >= -1) && (x < 1)) {
cout << "The nunber you have entered is valid and lies in the interval -1,1!" << endl;
}
else if ((x < -1) || (x >= 1)) {
cout << "Unfortunetely the number you entered is valid but does not lie in the interval" << endl;
}
else {
cout << "Error you have not entered a valid real number!" << endl;
}
return 0;
}