Code must be in C++ Write a program that computes the exam statistics for a clas
ID: 3804912 • Letter: C
Question
Code must be in C++
Write a program that computes the exam statistics for a class of 10 students. You should use an array that stores exam scores for 10 students. The program will ask the user to enter scores for each student and when all the scores are entered, the program computes the average score, minimum score maximum score, and should print all the scores entered by the user. constraint: You must use for loop to read the score, compute average, min, max, and to print the Scores You can use as many for loops as you wish. nput Validation: the exam score must be 1 score K- 100Explanation / Answer
#include <stdio.h>
#include<iostream>
using namespace std;
int main(void) {
int scores[10];
float sum=0.0, average;
int maxScore, minScore;
cout<<"Enter the exam scores between 1 to 100"<<endl;
for (int i=1;i<=10;i++){
cout<<"Enter score for student " <<i <<" : ";
cin>>scores[i];
}
cout<<"EXAM STATISTICS: "<<endl;
for(int i=1;i<=10;i++)
{
sum+=scores[i];
}
average=sum/10;
cout<<"Average Score: "<<average<<endl;
maxScore=scores[0];
for(int i = 1;i <= 10; i++)
{
if(scores[i] > maxScore )
maxScore = scores[i];
}
cout << "Maximum score:" << maxScore<<endl;
minScore=scores[0];
for(int i = 1;i <= 10; i++)
{
if(minScore > scores[i])
minScore = scores[i];
}
cout << "Minimum score:" << minScore<<endl;
cout<<"Scores entered by the user"<<endl;
for(int i=1;i<=10;i++)
{
if(i==10)
cout<<scores[i];
else
cout<<scores[i]<<",";
}
return 0;
}
here is the whole program in c++ which is taking input of 10 students score and printing the average, maximum, minimum and finally the scores entered by user.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.