Chapter 2. Communication: basic input and output
This chapter covers
An important part of any program is interacting with the user. For almost any program or game you might want to create, you’ll need to accept numbers, strings, or input from the user, display or draw output back to the user, or both. This chapter will teach you how to get strings and numbers from the user and write strings and numbers back.
As you learned in chapter 1, your calculator shares its architecture with any common computer. You may recall that calculators and computers both have connected devices called input and output devices, as shown in figure 2.1. For computers, things like the monitor, the speakers, and the printer are the output. They’re devices the computer can instruct to communicate something to the user. Computers’ input devices, such as the keyboard, the mouse, and a microphone, let the user talk back to a computer. In much the same way, calculators have input and output devices for communication with the user: the keypad gives the user a way to instruct the calculator; the LCD screen lets the calculator show things back to the user.
Figure 2.1. The input and output devices of a computer (left) and a calculator (right), excerpted from figure 1.2
