SWITCH CASE:
SYNTAX:
switch(expression)
{
case 1: statement 1;
break;
case 2: statement 2;
break;
case 3: statement 3;
break;
default : statement 4;
break;
}
SAMPLE PROGRAM :
#include<iostream.h>
#include<conio.h>
void main()
{
int ch;
cout <<"\n ENTER THE NUMBERS BELOW FIVE ";
cin >> ch;
switch(ch)
{
case 1:cout <<"\n THE NO. IS ONE ";
case 1:cout <<"\n THE NO. IS ONE ";
break;
case 2: cout <<"\n THE NO. IS TWO ";
break;
case 3: cout <<"\n THE NO. IS THREE ";
break;
case 4: cout <<"\n THE NO. IS FOUR ";
break;
default : cout <<"\n ENTER THE CORRECT CHOICE ";
break;
}
getch();
}