Programming Fundametals in C+ Lec 3
Programming Fundametals in C+ Lec 3
Lab
Lecture 3
Expression
Yes
Case1 Code block 1
No
Yes
Case2
Code block 2
No
Default code
switch ( grade)
{
case ‘A’ :
cout << “ Excellent ” ;
case ‘B’ :
cout << “ Very Good ” ;
case ‘C’ :
cout << “Good ” ;
case ‘D’ :
cout << “ Poor ” ;
case ‘F’ :
cout << “ Fail ” ;
}
Break statement is used inside each case block, Its used to terminate the switch statements.
default :
cout << “ Please Enter Grade from ‘A’ to ‘D’ or ‘F’ “ ;
label: ;
//block of statements
goto label;
Find min and max number from user entered numbers using switch statement
Print day of the week selected by the user through switch statement