How to use Nested Switch statements in C++

Home Questions How to use Nested Switch statements in C++

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by   2 years, 2 months ago.

  • Author
    Posts
  • #6670 Reply

    admin
    Keymaster
    Offline
    Topics: 65
    Replies: 65

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

  • #6758 Reply

    admin
    Keymaster
    Offline
    Topics: 65
    Replies: 65

    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++

You can use BBCodes to format your content.
Your account can't use Advanced BBCodes, they will be stripped before saving.

Your information: