Write a program that uses an array of string objects to hold the five student names, an array of five characters to hold the five students’ letter grades, and five arrays of four double s to hold each student’s set of test scores.
The program should allow the user to enter each student’s name and his or her four test scores. It should then calculate and display each student’s average test score and a letter grade based on the average. Input Validation: Do not accept test scores less than 0 or greater than 100.
#include <iostream>
#include <string>
using namespace std;
output is
ame: red Average: 405.75 Grade: F
Name: blue Average: 0 Grade:
Name: green Average: -5.48688e-12 Grade:
Name: pink Average: 4.59135e-41 Grade:
Name: Lee Average: -5.48687e-12 Grade:
There is no point in using avg[i]=(sum/4);. Instead of this, for student 1 use avg[0]=(sum/4);, for student 2 use avg[1]=(sum/4); and so on.
Also, you have to clear the value of sum after each average, so put sum = 0; after average.
In the grades, you have to specify which average you are working with. So put a for(i = 0; i < 5; i++) before the letter grades.
P.S.: In for loops, you don't need to put int i, you already did that in the beginning. Also, prefer using comments instead of braces to delimit the code parts.