5. Arrays: All in a Row...

Much of the power of computers stems from their ability to work on arbitrarily large amounts of data—arbitrary in this case meaning “any number of times you like.”

An array is an arbitrarily large collection of data indexed by number. With a few keystrokes you can create array data structures of any size. Then, by using loops, you can process the data structure efficiently, often with just a few lines of code. Loops and arrays go hand in hand. Together, they help make programs not just powerful but useful.

A First Look at C++ Arrays

Suppose you’re writing a program to analyze scores given by five judges in an Olympic kite-flying contest. You need to store all five values for a while so you can measure statistical properties: ...

Get C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart, Second Edition 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.