Your variable 'choice' is an int, and thus can only hold an integral value. The letter 'x' is not an integral value, so that's inappropriate for this situation.
Since the user is inputting a character, you'll want to use
char
for input. You'll then want to compare it with the
characters '0', '1', 'x', etc. Not the
numbers 0, 1, etc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
char choice;
//...
cin >> choice;
//...
switch(choice)
{
case '0':
...
case '1':
...
case 'x':
...
};
|
Note the numbers inside of 'single quotes'.
EDIT:
Also:
Thank you for posting in an intelligent, comprehendable, and well formatted manner. I can't tell you how many people come to these boards and post ambiguous questions and slap their code in without any explanation/formatting/etc.
Seeing posts like this from newcomers is a nice breath of fresh air. We need newbies to use this post as an example of how to ask a question the right way.