How do I do this?

This is for my online computer science work, and I can't figure out how to start:

Assume that PrecinctReport is a structured type with these fields, address (a string), and three int fields which are counts of crimes in the given precinct: felonies, murders, and robberies. Assume that NPRECINCTS is a pre-declared int constant and that an array named allPrecincts with NPRECINCTS elements, each of type PrecinctReport has been declared and initialized

Assume that an int variable murderCount has been declared. Write the necessary code that traverses the allPrecincts array and adds up all the murder counts storing the resulting total in murderCount.

Thanks.
You just need to loop through the array and sum the numbers in each element's "murders" field.
Topic archived. No new replies allowed.