Question: Write a program to count each whole number between 1 and 1 0 0 and then report the mode. The program should prompt the user
Write a program to count each whole number between and and then report the mode. The program should prompt the user for numbers until the user enters a value that is NOT between and When determining the mode, choose the largest number if multiple numbers are tied for the most frequent.
Create two separate functions, one for counting the input values and another for searching for the largest count.
countInputValueswill accept an integer array and its length as parameters. Each element of the array will represent the count for a number. For example,countrepresents the number of s the user has entered. The function will prompt the user for numbers between and Then it will update the array at the appropriate index.
modeIndexwill also accept an integer array and its length as parameters. This function will return the index of the mode ie the location in the array containing the largest value If multiple numbers are tied for the most frequent, return the largest index. Remember, any array parameter that isn't modified within the function should beconst
Output the result in this format:
Sample Output user input is in yellow
Enter a number between and or to exit: Enter a number between and or to exit: Enter a number between and or to exit: Enter a number between and or to exit: Enter a number between and or to exit: Enter a number between and or to exit: Enter a number between and or to exit: Enter a number between and or to exit: Enter a number between and or to exit: Enter a number between and or to exit: Enter a number between and or to exit: The most frequent value was appearing times.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
