Menu Browsing

Many computer programs use menus as part of the user interface. Menus make programs easier for the user, but they do pose some problems for the programmer. Let's see what's involved.

A menu offers the user a choice of responses. Here's a hypothetical example:

Enter the letter of your choice:
a. advice           b. bell
c. count            q. quit

Ideally, the user then enters one of these choices, and the program acts on that choice. As a programmer, you want to make this process go smoothly. The first subgoal is for the program to work smoothly when the user follows instructions. The second subgoal is for the program to work smoothly when the user fails to follow instructions. As you might expect, the second goal is the more difficult because it's ...

Get C Primer Plus, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.