© Will Briggs 2021
W. BriggsC++20 for Lazy Programmershttps://doi.org/10.1007/978-1-4842-6306-8_10

10. Arrays and enum

Will Briggs1  
(1)
Lynchburg, VA, USA
 

In this chapter are: sequences (arrays) of values, enumeration types, weather data, and board games.

Arrays

“If you don’t like the weather in these parts,” the old-timer said with a twinkle in his eye, “wait a few minutes.”

Let’s find out if he’s right. We’ll take ten temperatures at one-minute intervals and see the variation. I’ll start like this:
double temp1; sout << "Enter a temperature: "; sin >> temp1;
double temp2; sout << "Enter a temperature: "; sin >> temp2;
double temp3; sout << "Enter a temperature: "; sin >> temp3;
That’s getting old fast. Maybe there’s a better way to store ten numbers. ...

Get C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners 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.