Friday, August 7, 2009

SWITCH

You can extend an if else sequence to handle five alternatives.But c++switch statement handles selecting a choie from an extend list more easily here is a general from for switch statement.
switch (integer expression)
{
case lable 1:
statements;
break;
case lable 2:
statements;
break;
default;
statement;
}
A c++ switch statement allows the user to select a sequences by specifying any option on reaching a switch the program jumps to the line labeled with value corresponding,to the value of intiger expression once a program jumps to a particular line in switch,if then sequently executes all the statements following that line in the switch unless you explecitly direct it otherwise.Execution does not automatically stop at the next case.To make execution stop at the end of a paticular group of statements.You must use the break statements.

No comments:

Post a Comment