must compile You are to write a C++ program which reads and computes grades for
ID: 3633474 • Letter: M
Question
must compileYou are to write a C++ program which reads and computes grades for a class of students.the main function will operate by calling user-defined functions to process 1 student at a time. Here is a skeleton program:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string first, last;
int test1, test2, test3, test4;
double average;
char grade;
//
// Read data for one student at a time until read_grades returns false
//
while ( read_grades ( first, last, test1, test2, test3, test4 ) ) {
// Compute the average from the 4 test grades
average = compute_average ( test1, test2, test3, test4 );
// Determine the letter grade from the average:
// A if average >= 89.5
// B if 79.5 <= average < 89.5
// C if 69.5 <= average < 79.5
// D if 59.5 <= average < 69.5
// F if average < 59.5
grade = letter_grade ( average );
// Print the student's name, grades, average and letter grade
report_grade ( first, last, test1, test2, test3, test4, average, grade );
}
return 0;
}
Explanation / Answer
#include #include double compute_average( int,int,int,int); char letter_grade( double ); void report_grade(char f[], char l[], int t1,int t2,int t3,int t4, double avg, char ch); int main() { char first[80], last[80]; int test1, test2, test3, test4; double average; char grade; char ch; do { coutlast; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.