123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
#include <iostream> #include <stdio.h> #include <string> using namespace std; void PrintMenu(void) { cout <<"+---------Menu---------+" << endl; cout << "|Store(s)" << endl; cout << "|Exit(e)" << endl; cout << "+----------------------+" << endl; } int main() { bool RunGame; bool MenuError; char MenuChoice; while (RunGame == true) { while (MenuError == true) { PrintMenu(); cout << "What would you like to do?: "; cin >> MenuChoice; if (MenuChoice == 's') { cout << "go to store" << endl; } else if (MenuChoice == 'e') { RunGame = false; } else { MenuError = true; cout << "\nenter a valid choice" << endl; } return MenuChoice, MenuError, RunGame; } } return 0; }