|
From: Jared E. <ja...@vo...> - 2001-01-18 00:09:43
|
Here is a little snip for you,
switch (myvar) {
case 1:
cout << "Number 1 detected" << endl;
break;
case 2:
cout << "Number 2 detected" << endl;
break;
case 3:
cout << "Number 3 detected" << endl;
break;
default:
cout << "Anything but 1, 2, or 3 was detected" << endl;
}
Hope that helps you understand switches a little more.
At 05:18 PM 1/17/2001 -0500, you wrote:
>I was referred to use this instead of if / else statements I m trying to
>understand how to use it I have read the article on MSDN I ask can someone
>write a small program that will get the variable from the keyboard and a
>small action for instance if you enter 1 it says the number 1 detected or
>Z would say the letter z detected as when I see this in use I can fully
>understand how to use it thanks :O)
|