What is fall through? Explain all three jump statements.
Write a menu driven programme based on the user's choice. Use two array: one to store the name of the cities and other to store their STD codes.
Case 1: print the city with respect to the STD code entered by the user.
eg:
Input- 0522
Output: LUCKNOW.
Case 2:print the code with respect to city entered by the user.
Eg:
Input- LUCKNOW
Output:0522.
Answers
In computer programming languages, a switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via a multiway branch.
Switch statements exist in most high-level imperative programming languages such as Pascal, Ada, C/C++, C# and Java, and in many other types of language, using such keywords as switch, case, select or inspect.
Switch statements come in two main variants: a structured switch, as in Pascal, which takes exactly one branch, and an unstructured switch, as in C, which functions as a type of goto. The main reasons for using a switch include improving clarity, by reducing otherwise repetitive coding, and (if the heuristics permit) also offering the potential for faster execution through easier compiler optimization in many cases.