O'Reilly logo

C Programming: Visual Quickstart Guide by Marc Liyanage, Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required