+ 3

How to use switch statement

29th Nov 2017, 5:47 AM
Harsh Singh
Harsh Singh - avatar
4 Antworten
+ 7
The switch statement is an Alternative to multiple if statements var a=1; switch(a): case 1: //that if a is equals 1 cout<<1; break; case 2: //that is if a equals 2 cout<<2; break; The output is "1" since a equals 1
29th Nov 2017, 5:51 AM
᠌᠌Code X
᠌᠌Code X - avatar
29th Nov 2017, 6:16 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 2
swich operator is use to multiple operation on a single expression
29th Nov 2017, 3:16 PM
Harsh Singh
Harsh Singh - avatar
0
Swich statement is used to multiple if else or nasted if else statement in a program... Swich (text) { case 1: Break; case2: Break; . . . Default expression }
26th Nov 2018, 6:40 PM
Gyanendra Gupta
Gyanendra Gupta - avatar