Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++, how would I return the frequency of the mode back to the main function? u are required to implement these requirements in this problem:
C++, how would I return the frequency of the mode back to the main function?
u are required to implement these requirements in this problem: a. Ask the user to enter the size of an array in main method. The program should validate the size of an array, if it is not in between 5 to 50 (inclusive), ask the user to re-enter until it is valid. b. Write a function named ArrayAllocator that dynamically allocates an array of integers. The function should accept an integer argument indicating the number of elements to allocate. The function should return a pointer to the array c. Call ArrayAllocator in the main function and create an array of the size provided by the user. d. Populate the array with random integer numbers 0 to 9 using seed value as 6000 in main method and display the contents of the array. e. In statistics, the mode of a set of values is the value that occurs most often or with the greatest frequency. Write a function named FunctionMode that accepts as arguments an array of integers and an integer that indicates the number of elements in the array. The function should determine the mode of the array. That is, it should determine which value in the array occurs most often. The mode is the value the function should return. If the array has no mode (none of the values occur more than once), the function should return 1. (Assume the array will always contain nonnegative values.). You need to use pointer notation and dynamic memory allocation instead of array notation. f. Display the mode of the array with its frequency (number of times the mode value occurred in the array). bmit two screen captures, (1) when there is no mode (2) when the frequency of the de value is greater than or equal to 4Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started