johaness's blog

By johaness, history, 5 years ago, In English

A count has been made of the cars that have passed through a track for 24 hours. The results are stored in a file, in an array defined as hourlycars(1), hourlycars(2)... up to hourlycars(24) indicating the index locator the time of day, and the content of the variable the number of cars that passed at that time.

You want to develop a program that can determine:

a) The total number of cars that passed during the day.

b) How many hours of zero transit there were and what they were.

c) What was the hour of maximum transit and what number of cars passed.

d) What was the last time a car passed and what number of cars passed.

You should be able to do it by iterating only once through the array.

Good luck!!

Full text and comments »

  • Vote: I like it
  • -18
  • Vote: I do not like it