Inputting a Single Character

A simple interactive application will make a request (for a number or a Yes/No answer) and respond accordingly. Doing so can be described as a four-step process:

1.
Prompting the user, indicating the type of information requested (Figure 5.1)
Figure 5.1. Letting the user know what type (and often, which format) of information is requested is an important facet of your applications.

2.
Reading the input typed into the keyboard
3.
Validating that the input is of the proper format
4.
Reacting based on the value of the input

This chapter will teach all of these steps from the ground up.

The simplest type of input to be read ...

Get C Programming: Visual Quickstart Guide 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.