Need some guidance with this program. Never had experience with sentinels so I'm not sure where to start to calculate the multiple grade inputs.
Requirements:
- Sentinel needs to be used to indicate when there are no more students to process
- Will read data about a student one at a time
- Will read the name of the students and their 10 grades
- Each grade must be an integer between 0 and 100 inclusive
- Output contains the student's name, average, and letter grade
- When there are no more students to process, the user will type in the word "done"
- The program must recognize "done" as the sentinel value used to indicate there are no more students to process
Example Input:
John Smith
90 90 78 89 90 55 66 90 90 90
Example Output:
Student Name: John Smith
Average Grade: 82.8
Letter Grade: B
My attempt for the setup:
#include <iostream>
#include <stdlib>
using namespace std;
// This function will display information about the program to the user.
void displayUserInstructions();
// Reads the test grades
int getnumericGrades();
//Calculates the average
double computeAverage();
//Determines the letter grade based on the average
char computeLetterGrade();
//Outputs the average to the monitor
void displayOutput(int numeric_grade, double average, char letter_grade);
int main()
{
char studentName[50];
int numeric_grade;
double average;
char letter_grade;
displayUserInstructions();
cin.ignore(1); // skip past the end-of-line character
cout << "Enter the students's full name (first name followed by last name): ";
cin.getline(studentName, 49);
numberic_grade = getnumericGrades();
average = computeAverage();
letter_grade = computeLetterGrade();
displayOutput(int numeric_grade, double average, char letter_grade);
return 0;
}
void displayUserInstructions()
{
cout << "\n\n";
cout << "This program will read grades for\n";
cout << "assignments completed by students and will\n";
cout << "ouput the average for each student with\n";
cout << "the equivalent letter grade for the average.\n\n";
}