0
#include <iostream>
#include <cstdlib>
#include <string>

using namespace std;

bool is_valid (char& s)
{
  return s == '1' || s == '2';
}

bool is_submenu(char& m)
{
  return m == 'x' || m == 'y';
}


int main()
{
  char choice;
  cout << "enter your choice\n";
  cin >> choice;

  if ( is_valid(choice) )
  {
    if ( choice == '1' )
    {
      char toys;
      cout<<"which toy would you like? A or B";
      cin>>toys;
   
     // THIS IS WHERE THE PROGRAM STOPS WORKING
      if( toys == 'A' )
      { 
       cout<<"Here you go";
      }
      else
      {
        //does something else
      }  
    } 
    else if ( choice == '2' ) {

      cout << "what would you like from the submenu?\n";
      cin >> choice;

      if ( is_submenu(choice) )
      {
        if ( choice == 'x' )
        {
          cout << "Hello"; //does something
        }
        else if ( choice == 'y' )
        {
          cout << "what"; //does something
        }
      }
    }
  }

  cin.get();
  cin.get();
  return 0;
}

Posted it as a comment.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.