A football team plays a football game almost every month. It stores the number of goals scored per month in an array of size 12. The number of goals scored on January is stored in the first element of the array (at index 0). The number of goals scored on February is stored in the 2nd element of the array (at index 1) and so on. a. The team wants to find the month in which they scored the maximum number of goals. Write a function named String Max(int[] A) that takes the array of goals and returns the month name (a string value) in which they scored the maximum number of goals. b. The team wants to find the number of games played during the year. Note that if the team didn’t play a game in a specific month, the value -1 is found. Write a function int NbGames(int[] A) to count the number of games played during the year. c. Write a program in which you create an array of size 12 having all its elements initialized to -1. Then ask the user to enter a month number and the number of goals scored in that month. Your program keeps reading information till the user decides to stop.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 23PE
icon
Related questions
Question

A football team plays a football game almost every month. It stores the number of goals scored
per month in an array of size 12. The number of goals scored on January is stored in the first
element of the array (at index 0). The number of goals scored on February is stored in the 2nd
element of the array (at index 1) and so on.
a. The team wants to find the month in which they scored the maximum number of goals.
Write a function named String Max(int[] A) that takes the array of goals and returns
the month name (a string value) in which they scored the maximum number of goals.
b. The team wants to find the number of games played during the year. Note that if the
team didn’t play a game in a specific month, the value -1 is found. Write a function int
NbGames(int[] A) to count the number of games played during the year.
c. Write a program in which you create an array of size 12 having all its elements
initialized to -1. Then ask the user to enter a month number and the number of goals
scored in that month. Your program keeps reading information till the user decides to
stop.

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning