Skip to main content

How To Think Like a Computer Scientist C++ Edition The Pretext Interactive Version

Section 8.1 Compound values

Most of the data types we have been working with represent a single valueβ€”an integer, a floating-point number, a boolean value. strings are different in the sense that they are made up of smaller pieces, the characters. Thus, strings are an example of a compound type.
Depending on what we are doing, we may want to treat a compound type as a single thing (or object), or we may want to access its parts (or instance variables). This ambiguity is useful.
It is also useful to be able to create your own compound values. C++ provides two mechanisms for doing that: structures and classes. We will start out with structures and get to classes in ChapterΒ 14 (there is not much difference between them).

Checkpoint 8.1.1.

Checkpoint 8.1.2.

Checkpoint 8.1.3.

Which is different from the others because it is does not represent a single value?
You have attempted of activities on this page.