#include <iostream>
usingnamespace std;
int main ()
{
char answer;
cout << "Tsuki! Did you know? 'y' Yes, 'n' No?\n";
cin >> answer;
switch (answer)
{
case'n':
cout << "You didnt? Well then I guess you should know. I love you!\n";
break;
case'y':
cout << "You did? You must be some sort of amazing! Well played!\n";
break;
default:
cout << "stop playing games, my love!\n";
break;
}
cin.ignore().get();
return 0;
}
What do you think the value of answer is?
Go back and check how a switch statement works.
Your switch statement is expecting answer to have the binary value of 1 or 2.
The statements answer == no;
answer == yes;
will have no effect. The condition will be evaluated if that branch of the switch statement is executed, but the result is ignored.