#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.

Nevermind.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.