Home Forums Programming How to use Nested Switch statements in C++

Tagged: 

  • Author
    Posts
  • admin
    Keymaster
    Post count: 111

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

  • admin
    Keymaster
    Post count: 111

    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;
    }
    
Reply To: How to use Nested Switch statements in C++
Your information: