Switch help

Hi i want to make a switch witch have a letter instead of numbers like

1
2
3
4
Switch(adasd)
case y:

case n:


is it possible
Sure it is, it's just a switch with characters.

1
2
3
4
5
6
7
8
9
10
11
char my_char = 'y';

switch(my_char)
{
   case 'y':
      cout << "Char is y" << endl;
      break;
   default:
      cout << "Char is not y" << endl;
      break;
}
oooh so i had to use char thingy
thanks
closed account (zb0S216C)
So long as the case label evaluates to an integral type, it should be fine.

Wazzak
Topic archived. No new replies allowed.