|
|
|
|
|
|
|
Now that we've seen how to write identifiers, we look at some of the things that C++ allows us to name. |
|
|
|
|
|
|
|
|
A computer program operates on data (stored internally in memory, stored externally on disk or tape, or input from a keyboard, text scanner, or electrical sensor) and produces output. In C++ each piece of data must be of a specific data type. The data type determines how the data is represented in the computer and the kinds of processing the computer can perform on it. |
|
|
|
 |
|
 |
|
|
Data Type A specific set of data values along with a set of operations on those values. |
|
|
|
|
|
|
|
|
Some types of data are used so frequently that C++ defines them for us. Also, programmers may define their own data types. We use the standard (built-in) data types until Chapter 10, where we show you how to define your own. |
|
|
|
|
|
|
|
|
Overview of C++ Data Types The C++ built-in data types are organized into simple types, structured types, and address types (see Figure 2-1). |
|
|
|
|
|
|
|
|
Do not feel overwhelmed by the quantity of data types shown in this figure. This chapter introduces you to the simple types only. The structured types and address types come much later in the book. First we look at the integral types (those used to represent integers), and then we consider the floating types (used to represent real numbers containing decimal points). |
|
|
|
|
|
|
|
|
Figure 2-1
C++ Data Types |
|
|
|
|
|