I want this program to check for a number
If it is between 1-20 it must print the "IT IS LIKE I SAID" msg.
If not it shoudl print "NOT IN THAT SPACE"
If however the number is 1 or 20 it should print "BORDERLINE NUMBER"
What am I doing wrong?It always evaluates on the "BORDERLINE NUMBER" condition...
#include <iostream>
usingnamespace std;
main()
{
longint x;
cout<<"Please enter a number. I will see if the number is between 1-20 and tell you."<<endl;
cin>>x;
if ((x>=1)&&(x<=20))
{
if ((x=1)||(x=20))
{
cout<<"Borderline number."<<endl;
}
else
cout<<"It is like I said..."<<endl;
}
else
{
cout<<"Not in that space."<<endl;
}
cout<<"Thank you." ;
return 0;
}