switch() case 1: Question

This is a discussion on switch() case 1: Question within the C++ Programming forums, part of the General Programming Boards category; ok i fixed it now guys, sorry about that. i was trying to put the if() statement before the case ...

  1. #1
    Registered User Zero_X's Avatar
    Join Date
    Mar 2006
    Posts
    19

    switch() case 1: Question

    ok i fixed it now guys, sorry about that. i was trying to put the if() statement before the case 3:... i switched it to inside of the case 3: and it worked fine.
    Code:
    cout<<"1) Option-A\n";
    cout<<"2) Option-B\n";
    cout<<"3) Option-C\n";
    cout<<"Selection: ";
    int x;
    cin>>x;
    switch(x){
                   case 1:
                            cout<<"You Selected A\n";
                            break;
                   case 2:
                            cout<<"You Selected B\n";
                            break;
                   case 3:
                           cout<<"You Selected C\n";
                           break;
                  }
    Last edited by Zero_X; 04-18-2006 at 01:43 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 03-05-2009, 11:32 AM
  2. switch case statement
    By stanlvw in forum C++ Programming
    Replies: 3
    Last Post: 02-26-2008, 05:06 AM
  3. Replies: 27
    Last Post: 10-11-2006, 05:27 AM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  5. Changing bkgrnd color of Child windows
    By cMADsc in forum Windows Programming
    Replies: 11
    Last Post: 09-11-2002, 12:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21