The script must define 4 functions listaverage listminimum l
The script must define 4 functions
list_average
list_minimum
list_maximum
above_average
list_average
This functions must have the following header
This function should compute the average of the numbers in the last and return that number rounded to the nearest whole number.
list_minimum
This functions must have the following header
This function should loop through the list and find the smallest number in the list.
You should assume that no number in the list is greater than 100.
Use the following algorithm
list_maximum
This functions must have the following header
This function should loop through the list and find the largest number in the list.
You should assume that no number in the list is less than 0.
Use an algorithm similar to the one above.
above_average
This functions must have the following header
This function should call list_avearage to compute the average and count the number of entries that are greater than that average.
Run code
At the bottom of the script you must have the following code
Testing
Your output should look exactly like this
Solution
#include<iostream>
using namespace std;
int list_average(int number_list[]);
int list_minimum(int number_list[]);
int list_maximum(int number_list[]);
int above_average(int number_list[]);
int main()
{
int numbers[15]={62, 60, 58, 50, 85, 93, 99, 77, 72, 74, 61, 68, 73, 65, 57};
cout<<\"numbers :\";
for(int i=0;i<15;i++)
{
cout<<numbers[i]<<\" \";
}
int avg=list_average(numbers);
cout<<\"\ average: \"<<avg;
int min=list_minimum(numbers);
cout<<\"\ minimum: \"<<min;
int max=list_maximum(numbers);
cout<<\"\ maximum: \"<<max;
int total=above_average(numbers);
cout<<\"\ above average: \"<<total;
return 0;
}
int list_average(int number_list[])
{
int sum=0;
for(int j=0;j<15;j++)
{
sum+=number_list[j];
}
int average=sum/15;
return average;
}
int list_minimum(int number_list[])
{
int minimum=number_list[0];
for(int k=1;k<15;k++)
{
if(minimum>number_list[k])
{
int temp=minimum;
minimum=number_list[k];
number_list[k]=temp;
}
}
return minimum;
}
int list_maximum(int number_list[])
{
int maximum=number_list[0];
for(int m=1;m<15;m++)
{
if(maximum<number_list[m])
{
int temp=maximum;
maximum=number_list[m];
number_list[m]=temp;
}
}
return maximum;
}
int above_average(int number_list[])
{
int summ=0;
int count=1;
for(int n=0;n<15;n++)
{
summ+=number_list[n];
}
int averge=summ/15;
for(int x=0;x<15;x++)
{
if(number_list[x]>averge)
{
++count;
}
}
return count;
}


