When a user enters multiple keystrokes the meny prints multiple times. It should spit out an error and reprint the menu once...what gives?
void mainMenu(char entries[], int index[])
{
char choice;
cout << "Please choose 1, 2, or 3.\n";
cout << "1. Save a new password\n";
cout << "2. Display all passwords\n";
cout << "3. Exit\n\n";
cout << "Choose 1, 2, or 3: ";
cin.get(choice);
while(choice != '1' && choice != '2' && choice != '3')
{
cout << "** Invalid Entry **\n";
cout << "Please choose 1, 2, or 3.\n";
cout << "1. Save a new password\n";
cout << "2. Display all passwords\n";
cout << "3. Exit\n\n";
cout << "Choose 1, 2, or 3: ";
cin.get(choice);
}
switch(choice)
{
case '1': newEntry(entries, index);
break;
case '2': display();
break;
case '3': exit();
break;
default: cout << "\nInvalid Entry\n";
}
}