csci 20 :: book learning challenge 10 (due tues, apr 5)
Submitting your work: Complete this exercise on your own.

Fill in all of the "Answer" boxes, then print the answer grid that you see after you press "Prepare for printing".

Staple all pages together and submit to the instructor on the date listed above.

Questions:

READ: C++ Arrays, Arrays then answer the following:

Your name:
  1. Write the code to declare an int array named counters of size 5. Do not provide any initial values.
    Answer:
  2. Write the code to declare a string array named items of size 5. Provide the following initial values in the declaration: "shoes", "hats", "glasses", "rings", "watches".
    Answer:
  3. Assign the value 2 to the first element of the array counters that you declared above.
    Answer:
  4. Assign the value "scarves" to the last element of the array items that you declared above.
    Answer:
  5. Assign the value of the second element of the array counters that you declared above to the variable itemCount, and assign the value of the second element of the array items to the variable itemName.
    int itemCount = 0;
    string itemName;
    Answer:
  6. Write a for loop to display each value in the array counters that you declared above, one per line. Describe what you see in the output.
    Answer:
  7. Write a for loop to display each value in the array items that you declared above, one per line.
    Answer:
  8. Write a for loop to populate the array counters with the values 2, 4, 6, 8, 10. You must have only one statement in the for loop, and you must use the loop iterator (i) from you loop to produce these values.
    Answer:
  9. Write a for loop to display the values of the arrays counters and items "in parallel" so that each item is displayed beside a count, one pair per line. For example, the first line of output would be:
    shoes: 2
    Answer:
  10. Write a for loop to display the values of the arrays counters and items "in parallel" to match the following -- you must produce the number next to "Item #" using the loop iterator (i):
    Item #2 hats 4
    Answer:

Total points for this book learning challenge:

150 points