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

Can someone help me make this C++ assignment using functions. You have been sele

ID: 3669753 • Letter: C

Question

Can someone help me make this C++ assignment using functions.

You have been selected to write a program to calculate the scores for a local diving competition. There are 6 judges who are rating each diver on a scale of 1 to 10. Scores can be entered up to 2 decimal places. You are going to write a program that will read in the scores and determine the average score. Your program will also determine the highest and lowest score given to each diver. Your program should implement functions that perform the following tasks: Accept the data - function should prompt the user for the judge's score. Error checking should validate that it is in the range of 1 to l1 The function should be called for each of the scores. Determine the highest score - return the highest score of all the scores passed to the function Determine the lowest score - return the lowest score of all the scores passed to the function Average the scores - display the average score of all the scores passed to the function. Keep the following points in mind when creating your program: Output should be labeled, aligned, and formatted to 2 decimal places. Do not use global variables in your program. Make sure you are using the correct data types and descriptive variable names. Add a comment to the top of your program that includes your name, the program name, and a description of the program code. Include descriptive comments throughout your program. Test your calculations!

Explanation / Answer

#include<iostream>
#include<string>
using namespace std;
void AcceptData(int a[])
{
int i=0;
int num;
cout<<"Enter scores for a";
for(i=0;i<6;i++)
{
cin>>num;
if(num <1||num>10)
{
cout<<"Please enter the value in the range 1..10";
cin>>num;
}
a[i]=num;
}

int max=a[0];
int min=a[0];
float avg=0;
for(i=0;i<6;i++)
{
if(a[i]>max)
{
max=a[i];
}
}
cout<<"Max score is "<<max;


for(i=0;i<6;i++)
{
if(a[i]<min)
{
min=a[i];
}
}
cout<<"Min score is "<<min;


int sum=0;
for(i=0;i<6;i++)
{
sum+=a[i];
}

avg=sum/6;

cout<<"Average of the scores is "<<avg;

}

int main()
{
int a[6];
AcceptData(a);
return 0;
}

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