Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include using namespace std; int main() { int *studentnum; int students_surveyed; int count; int total; double average; double median; cout < > students_surveyed; studentnum
#include
#includeusing namespace std; int main() { int *studentnum; int students_surveyed; int count; int total; double average; double median; cout<<"How many student are surveyed?"<< endl; cin>> students_surveyed; studentnum = new int [students_surveyed]; cout<<"Write by order, the number of movies watched by each of the students" < > studentnum [count]; } total += studentnum [count]; average = total/students_surveyed; { cout<< "The total of movies watched by all the students is:" << total << "movie." <
I need to build 3 functions, one that calculates and display the average of the movies watched, the median and the mode. Three different functions. I had the idea of using one of my functions but I don't know how to implement it as one of the requirements is: All array accessing should be done with pointers and not via direct access. For example, if I had an integer array called movies and wanted to access index.
This is my function:
double findAverage(double m[], int size) { int count = 0; double total = 0; for (int i = 0; ireturn total / count; } And also I need to do some input validation of the movies, I can't allow negative numbers.
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