Im doing a program that asks to enter a student's grades on four exams, I have to display the four grades and the average of the four grades, to the nearest tenth. The most problem im having is using the variable call total_grade which i have to initialize to zero.
#include < iostream>
#include <iomanip>
using namespace std;
int main()
{
int exam 1, // Exam 1 grade
exam 2, // Exam 2 grade
exam 3, // Exam 3 grade
exam 4; // Exam 4 grade
double averagr; // Average of the four exam grades
// Setup output stream for one decimal place
cout << setpresion(1)
<< setiosflags(ios::fixed)
<< setiosflags(ios::showpoint);
cout << "Enter the grade for Exam 1: ";
cin >> 100
cout << "Enter the grade for Exam 2: ";
cin >> 84
cout << "Enter the grade fot Exam 3: ";
cin >> 78
cout << "Enter the grade for Exam 4: ";
cin >> 94
// This program asks the user to enter a student
// grades on four exams and display the for grades
// and the average of four exams rounded to the
// nearest tenth.
total_grade=double (exam1 + exam2+ exam3 + exam4)/4;
cout << endl;
cout << "The average of the four exams is " << average << endl;
return 0;
}