Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is my work so far Write a Ct+ console application that accepts up to 5 numb

ID: 3887749 • Letter: T

Question

This is my work so far
Write a Ct+ console application that accepts up to 5 numbers from the user. Display all numbers, the highest, the lowest, and the average of the numbers. Ask the user if they want to continue entering another set of numbers Requirements 1) Comments are extremely important. Add comments as you code. Do NOT wat until you are done coding. Also, in the beginning of your codes include the following comments: a. Purpose of the program b. Name of the author c. Date 2) Use proper naming conventions for your variables and functions. 3) Tell the user what the program is all about. Do NOT start the program with "Enter a number" 4) Create an array to store the numbers. 5) The user does not have to enter all 5 numbers. They can enter fewer. However of course, you need at least two numbers to be able to look for the highest and the lowest. Make sure you explain this to the user. 6) Create three functions to perform the following tasks a. Calculate the highest number b. Calculate the lowest number. c. Calculate the average.

Explanation / Answer

#include<conio.h>

#include<iostream.h>

double calcAverage(double[],double);

double findHighest(double[],double);

double findLowest(double[],double);

int main( )

{

//declaring variables

double num=0,i,a;

double score[5];

double count = 0;

//clearing screen

clrscr();

cout << "How many numbers do you want to Enter?" <<endl;

cin >> num;

//condition for checking whether the number is between 2 and 5

while(num<2.0 || num>5.0)

{

cout <<"ERROR:Do not take number of scores lower than 2 or greater then 5 enter again :- ";

cin >> num;

}

//taking the values from user by for loop

cout<<"please enter the values ";

for(i=0;i<num;i++)

{

cin>>score[i];

}

//printing the highest lowest and average

a=findHighest(score,num);

cout<<"Highest score amond them : "<<a<<' ';

a=findLowest(score,num);

cout<<"Lowest score among them : "<<a<<' ';

a=calcAverage(score,num);

cout<< " Average score is : "<<a<<' ';

getch();

return 0;

}

//for calculating the highest

double findHighest(double score[],double num)

{

double i;

double highest=score[0];

for(i=1;i<num;i++)

{

if(highest<score[i])

highest=score[i];

}

return highest;

}

//for calculating the lowest

double findLowest(double score[],double num)

{

double i;

double lowest=score[0];

for(i=1;i<num;i++)

{

if(lowest>score[i])

lowest=score[i];

}

return lowest;

}

//for calculating the average

double calcAverage(double score[],double num)

{

double i;

double Avg=0;

for(i=1;i<num;i++)

{

Avg=Avg+score[i];

}

Avg=Avg/num;

return Avg;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote