© Will Briggs 2019
Will BriggsC++ for Lazy Programmershttps://doi.org/10.1007/978-1-4842-5187-4_10

10. Arrays and enum

Will Briggs
Lynchburg, VA, USA
In this chapter, sequences (arrays) of values, enumeration types, weather data, and board games are discussed.


“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 10 temperatures at 1-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 10 numbers. ...

Get C++ for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.