60 594
Assignments Done
Successfully Done
In April 2018

Answer to Question #21446 in C++ for Candice Battle

Question #21446
Albert Einstein teaches a business class at Podunk University. To evaluate the students in this class, she has given three tests. It is now the end of the semester and Alberta would like to have a program that inputs each student’s test scores and outputs the average score for each student and the overall class average. (Hint: The outer loop should allow for Ms. Einstein to input all the students, one by one, and the inner loop should accept the three exam scores and compute the average for each student.)
Expert's answer
#include <iostream>
#include <string>
using namespace std;

//Represents& students and their test scores
struct Student
string name;
int average_score;

int main()
int count;
cout<<"How many students do you have?"<<endl;
Student *students = new Student[count];
for(int i = 0; i<count; i++)
cout<<"What is the student's name?"<<endl;
cout<<"Please enter test scores:"<<endl;
students[i].average_score = 0;
for (int index = 0; index < 3; index++)
int current_score;
cout<<index+1<<" - ";
students[i].average_score /= 3; //Deviding by 3 to get average score;

int class_average = 0;
cout<<endl<<"Average scores of all students:"<<endl;

for (int i = 0; i < count; i++)
cout<<students[i].name<<" - "<<students[i].average_score<<endl;
class_average /= count;

cout<<"Overall class average: "<<class_average<<endl;

delete []students;

return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions