Question
Write a menu-driven C++ program that uses user-defined functions, arrays and references. Upon program execution, the screen will be cleared and the menu shown above
Write a menu-driven C++ program that uses user-defined functions, arrays and references. Upon program execution, the screen will be cleared and the menu shown above will appear at the top of the screen and centered. The menu items are explained below. Help Largest Frequency Quit H or h ( for Help ) option will invoke a function named help() which will display a help screen. The help screen(s) should guide the user how to interact with the program, type of data to be entered, and what results would the program produce. Each help screen should remain on the monitor until the user strikes any key. Once the user's input is processed, the screen will be cleared and the menu is displayed again. L or l ( for Largest ) option will invoke a function named largest( ) which will prompt the user for the number of elements of a float type array to be examined. The program will use a function named sizeOfArray( ), which will read from the keyboard, and then returns the number of elements, followed by another prompt to get the actual elements, using the function getInputs( ). The program will then call a function named findLargest( ) which will compute and return the largest number in the set. The program will then display the array elements, and the largest number using a function named display(), in the format shown below. The output shown is for an array of five elements with an array identifier a. a[0] = xxxx.xx a[1] = xxxx.xx a[2] = xxxx.xx a[3] = xxxx.xx a[4] = xxxx.xx Largest no. = xxxx.xx The function prototypes to be used are as follows: void largest(void); float findLargest(float l[], int& size); here, l is the base of the array, and size is the reference to the array size. Other function prototypes are: int sizeOfArray(void); float getInputs(void); void display(float array[], int& size); The results should stay on the screen with the following prompt which will appear on the lower right hand corner of the screen: Strike any key to continue... Once the user entered a key, the screen will be cleared and the menu is displayed again. F or f ( for Frequency) option will display the largest number in the array and the frequency of its occurrence. This option must be executed after the option L or l. If the array is not filled and the option F or f is selected, your program will issue and error and ask the user to select option L or l. The desired output is: Largest no. = xxxx.xx Frequency = xx Q or q (for Quit) option will clear the screen and returns the control to the Visual Studio IDE. Try your program with the following data sets and make sure your sample runs include them. set 1 : 20, -50, 40, 255 set 2 : 20, 43, 99, -100, 30, 0, 500 set 3 : -200 set 4 : 100, -50, -30, 90, 90, -30 set 5 : 0, 0, 0, 0 set 6 : 200, 200, 200, 200, 200, 200, 200, 200 set 7 : -6, -6, -6, -6, -6 set 8 : 0 Grading: Flowchart 10 points Meaningful Documentation 10 points Program execution without error 40 points, this includes proper use of function prototyping and definition and documentation Program logic and correct output formats 10 points, this includes all sample runs in the Word file H3 Size the array for 40 elements and your program should work for any size array up to 40 elements.
Step 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