Switch, While And Do/while Loops

Switch statements
The switch statement in C++ is the best alternative to the lengthy if statements that are used to compare a variable to different integral values. It is a multi-way branch statement. The switch statement is the control statement that allows any value to change the control of the execution.
My Switch Programs
Switch Vowel
Input

Output

Switch Choice
Input

Output

While Loop
Input

Output

Do While Loop
Input

Output

While Loop
The while loop is used to repeat a section of code an unknown number of times until a specific condition is met. For example, say we want to know how many times a given number can be divided by 2 before it is less than or equal to 1.
Do While Loop
The do/while loop is a variant of the while loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true.

