Switch statement in C and C++

Switch statement

In the previous section, I have discussed how to use conditional statement in C and C++ language where I showed only if-else statement. Now I shall show you another powerful keyword named switch statement to control program sequence in C and C++ 

How switch statement works

When you need to take a decision from multiple choices and select only one choice, you can use switch statement for that case. Say, you need to make a menu in your program. When a user fulfills a condition, he will get a result and when he fulfills another condition, he will find another result and so on. To handle this situation switch is your best friend. Switch statement works with case keyword. When a particular condition will be fulfill within switch, the corresponding case statement will be executed like making switch on or off in your electrical or electronics switch board.  

Tutorial on conditional statement in C and C++

conditional statement
In the previous sections, you have learnt about data type and the first program in C and C++ with visual studio. In this section, you will learn an important term which is necessary not only in C and C++ but also any other programming languages named conditional statement. It will help you to make the program so professional.