



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Parallel arrays are two or more arrays whose corresponding components hold related information. If you need to keep track of multiple items that are related, you can create more than one array where the information is related by the placement within the arrays.
In this lab, you process parallel arrays. After completing this lab, you will be able to: Process parallel arrays.
In the following exercises, select the correct answer for each question. Then design and write a program that uses parallel arrays.
(Circle the correct answer)
int stats[2][3] = {4, 4, 4, 3, 12, 15}; int totalHits = 0; for (int row=0; row<2; row++) totalHits += stats[row][0];
int stats[2][3] = {4, 4, 4, 3, 12, 15}; int atBats[2] = {0}; for (int row=0; row<2; row++) { for (int column = 0; column < 3; column++) atBats[row] += stats[row][column]; cout << “Player “ << row + 1 << “was up to bat “ << atBats[row] << “times.” << endl; }