sentinel terminated loop/avg calculation
I am working on this program and I need to add two things to it, first I need the program to accept many students names and scores (not just one) and add a sentinel terminated loop which the loop terminates when the students first name is "light" and last name is "truth". Also, on the student average calculation, I need to be able to drop the lowest score and count the highest score twice for example if the score were: 90 80 70 70 80, I would drop one of the 70's and count the 90 twice. I am really confused, any help would be greatly appreciated!
Code:
#include <iostream.h>
#include <iomanip.h>
int main()
{
char firstName[25];
char lastName[25];
float score[5];
char grade;
float avg=0.0;
float totScore=0.0;
int x=0;
int y=0;
cout << "Enter student's first name, last name, and five scores:";
cin >> firstName >> lastName;
for (x=0; x<5; x++)
{
cin >> score[x];
}
for (y=0; y<5; y++)
totScore += score[y];
avg = totScore/5;
{
if (avg >= 92.0)
grade='A';
else if (avg >= 83.0)
grade='B';
else if (avg >= 74.0)
grade='C';
else if (avg >= 65.0)
grade='D';
else
grade='F';
}
cout << lastName<< " , " << firstName << " " << setw(6) << setprecision(2)
<< "Average:" << avg << " "
<< "Grade:" << grade << endl;
return (0);
}