SpyTM Discussion Board

How to use Nested Switch statements in C++  

  RSS

admin
(@jayavinoth)
Member Admin
Joined:4 years  ago
Posts: 110
11/12/2015 3:20 am  

Hello,
Please provide me the Nested Switch statements syntax of C++.
I need it very urgent...


ReplyQuote
admin
(@jayavinoth)
Member Admin
Joined:4 years  ago
Posts: 110
11/12/2015 3:36 am  

You can have a switch as part of the statement sequence of an outer switch. Even if the case constants of the inner and outer switch contain common values, no conflicts arise.

switch(x) {
   case 1:
      switch(y) {
                   case 0: printf("example by eTechTricks.com");
                   break;
                   case 1: example(a,b);
                }
      break;
   case 2: printf("example 2 by eTechTricks.com");
      break;
}

ReplyQuote
  
Working

Please Login or Register