Question: I have written a program for you to complete. This problem is not to be included with the menu. Simply print when I run the
| I have written a program for you to complete. This problem is not to | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| be included with the menu. Simply print when I run the menu program that | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it is included in another project. You are to write a program that outputs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| the mean, median, and modes. Your task is to complete the function. This | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| will use structures to pass information from one function to the print function. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Stats *stat(const Array *array){ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //Non-working stub to be completed by the student | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cout< | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Stats *stats=new Stats; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stats->mode=new Array; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stats->mode->size=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int nModes=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stats->mode->data=new int[nModes]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stats->modFreq=1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stats->median=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return stats; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| I have also supplied the expected outputs you can compare against in a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| StatResults.txt file. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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
