# Question-   teacher has five students who have taken four tests c++ The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores. Write a program that uses an array of string objects …

Solution-

Question:-A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores.Write a program that uses an array of string objects to hold the five student names, an array of one character to hold the five students’ letter grades, and five arrays of doubles to hold each student’s set of test scores and average score.
The program should allow the user to enter each student’s name and his or her four test scores. The program should store each student’s information in the arrays [20 points]. It should then calculate and display each student’s average test score [20 points] and a letter grade based on the average [20 points].
Input Validation: Do not accept test scores less than 0 or greater than 100

Complete solution below:-

``````

#include <iostream>

#include <string>

using namespace std;

int main() {

string name;

double marks;

for (int i=0; i<5; i++) {

cout << "Enter student's name: ";

cin >> name[i];

for (int j=0; j<4; j++)

do {

cout << "Enter student test #" << j+1 << " marks: ";

cin >> marks[i][j];

} while (marks[i][j]>100 || marks[i][j]<0);

}

for (int i=0; i<5; i++) {

double avg = 0.0;

for (int j=0; j<4; j++)

avg += marks[i][j];

avg/=4;

if (avg < 101) grades[i] = 'A';

if (avg < 81) grades[i] = 'B';

if (average < 61) grades[i] = 'C';

if (avg < 41) grades[i] = 'D';

if (avg < 21) grades[i] = 'E';

cout << name[i] << ": " << average << " - " << grades[i] << endl;

}

}
```
```

# Our happy customers

They are fast in responding to homework questions. they have the best technical writers. Thanks for helping me with my programming doubts. Dyana
5 I contact to disklib for homework, they help me out, despite there was some technical issue they gone through extra mile for me and provide me good quality work in first priority. 100% recommended. Asif Waheed
5 Desklib's study resources are best & unique. Their study database is easy to access and easy to use.
100 % recommended. Mike Taylor
5 