c 2b 2b nested switch statements

Solutions on MaxInterview for c 2b 2b nested switch statements by the best coders in the world

showing results for - "c 2b 2b nested switch statements"
Iker
26 Feb 2020
1switch(ch1) {
2   case 'A': 
3      cout << "This A is part of outer switch";
4      switch(ch2) {
5         case 'A':
6            cout << "This A is part of inner switch";
7            break;
8         case 'B': // ...
9      }
10      break;
11   case 'B': // ...
12}
13
Angelina
24 Jun 2018
1#include <iostream>
2using namespace std;
3 
4int main () {
5   // local variable declaration:
6   int a = 100;
7   int b = 200;
8 
9   switch(a) {
10      case 100: 
11         cout << "This is part of outer switch" << endl;
12         switch(b) {
13            case 200:
14               cout << "This is part of inner switch" << endl;
15         }
16   }
17   cout << "Exact value of a is : " << a << endl;
18   cout << "Exact value of b is : " << b << endl;
19 
20   return 0;
21}