4. In response to this statement:
a. It takes in the value of the expression.
b. Then it will compare to the value of constant_expression1,if
it is satisfied, then the statements belonging to
constant_expression1 will be executed.
c. If constant expression1 is not satisfied, it will continue on
comparing all the constant_expressions until one is satisfied.
d. If none is satisfied, the statement(s) under default will be
executed.
5. Sample Problem:
A problem that lets you choose which
data to input, that is ,either your first
name, last name or middle name.
6. #include<iostream.h>
using namespace std;
int main ()
{ char name[10]
int opt;
cout<<“Selection…”
<<“n[1] Firstname”
<<“n[2] Lastname”
<<“n[3] Middlename”
<<“nYour choice:”;
cin>>opt;
9. Assignment:
Consider the problem with the secret number, if
there are more than one secret number, you can
use the switch to evaluate if the user have guessed
one of the secret number. Assuming there are three
(3) secret numbers, that is: 143,431 and 314;make a
program to guess the 3 secret numbers.