The switch/case statement is used when you are comparing an integer value against a number of integer constants:
If your code looks something like this:
int x = f();
if (x == 1)
do the stuff for 1;
else
if (x == 2)
do the stuff for 2;
else
if (x == 5)
do the stuff for 5;
else
if (x == 17)
do the stuff for 17;
you can re-write it to be this:
int x = f();
switch (x)
{
case 1:
do the stuff for 1;
break;
case 2:
do the stuff for 2;
break;
case 5:
do the stuff for 5;
break;
case 17:
do the stuff for 17;
break;
}