Now that you can read the keyboard directly you can change your menu programs so that they use the value of a raw keyboard input to control them. That way your users will not be irritated by having to press the return key after the letter that selects the menu entry; they will just press the key and the selected action will occur.
As a reminder, here is the final version of get_choice () from Chapter 8 (with comments about changes stripped out):
char get_choice(){
cout << "Action: (Press letter followed by Return): ";
while(true){
string input;
getdata(cin, input);
char const letter(toupper(input[0]));
int const choice(choices.find(letter));
// Check that choice is valid
if(choice < choices.size()){
return letter;
}
// Note you can only get here if the choice was not valid.
cout << ‘"’ << letter << ‘"’<< "is not an option.\n";
cout << "Please try again: ";
}
}
Modify that function so that users do not need to press Return to signify that they have made a choice. They should be able to simply press the appropriate key. You may need to look back to remind yourselt about such details as what choices is.
When you have made this modification to get_choice $O$ your menu program should work exactly as it did before with the exception that the user now needs to press only the key that indicates their choice.