C++ Code
Competition Score
the assignment must have a score system of 10 points from 10 judges, for the 10 athletes that are participating in the competition, the score should be from 0 to 10 from each judge to the 10 athletes. an example for one of the 10 athletes is shown below.
Jake Miller's results:
8.10, 7.10, 9.40, 7.20, 9.20, 6.40, 9.50, 8.40, 6.70, 6.60
The highest score of 9.50 and the lowest score of 6.40 were dropped
The average score is 7.84
#include <iostream>
using namespace std;
int main( )
{
double sum = 0;
double average = 0;
double lowest = 999999;
double highest = 0;
double arr[11];
string name;
cout<<"Enter the student's name: ";
cin>>name;
cout << "Please enter 10 scores from 10 judges" << endl;
for (int i = 0; i < 10; i++)
{
cout << "Please enter a score: ";
cin >> arr[i];
}
for (int i = 0; i < 10; i++)
{
sum += arr[i];
if (arr[i] < lowest)
{
lowest = arr[i];
}
if (arr[i] > highest)
{
highest = arr[i];
}
}
average = sum/10;
cout<<name<<"'s results"<<endl;
for (int i = 0; i < 10; i++)
{
cout << arr[i]<<" ";
}
cout << "\nThe lowest score of: " << lowest ;
cout << " and the highest score is: " << highest <<" were dropped"<<endl;
cout << "The average score is: " << average << endl;
return 0;
}
Comments
Leave a comment