I have this code:
int temp;
cin >> temp;
if(!cin){
cout << "a";
}else{
cout << "b";
}
When I put a number, it printed b
, but when I put a character, it printed a
. What is happening here?
I have this code:
int temp;
cin >> temp;
if(!cin){
cout << "a";
}else{
cout << "b";
}
When I put a number, it printed b
, but when I put a character, it printed a
. What is happening here?