/**********************************************************/
//switch2a.cpp 
//R. A. Hillyard
//Last Modified 09/24/2001
// 
//This program demonstrates the use of the switch statement
//Print a message based on user input
/*********************************************************/

#include<iostream>

using namespace std;

int main()
  {
  char choice = 'Y';       //holds user choice
 // bool flag = true;        //flag for loop
  
  while((choice == 'Y') || (choice == 'y'))
    {
    //print menu of choices and get user choice
    cout << "\n\nPlease choose one of the following\n";
    cout << "1\t for red\n";
    cout << "2\t for green\n";
    cout << "3\t for blue\n\n";
    
    cin >> choice;    //get user choice
    
    switch(choice)
      {
      case '1':
        cout << "You picked red\n";
        break;
      
      case '2':
        cout << "You picked green\n";
        break;
      
      case '3':
        cout << "You picked blue\n";
        break;
            
      default :
        cout << choice << " is not a valid entry - try again\n";
      }//end switch
    cout << "Do you want to continue? [Y/N] > ";
    cin >> choice;
    }

   return 0;
  }//end main

/**********************************************************



Please choose one of the following
1        for red
2        for green
3        for blue

1
You picked red
Do you want to continue? [Y/N] > y


Please choose one of the following
1        for red
2        for green
3        for blue

3
You picked blue
Do you want to continue? [Y/N] > Y


Please choose one of the following
1        for red
2        for green
3        for blue

2
You picked green
Do you want to continue? [Y/N] > n
*/