Hello Guys!
I need help for an assignment. Somehow my code will not correspond to what I'm looking for. I'm having a hard time to find what the problem is. If you guys can please help me, I'll be more than appreciate !!!!!
1) Create a program that will read in four grades entered by the user and store them in an array. The program will calculate the average of the four grades and print the average to the screen as well as the four grades that the user entered. Test your program.
Input: four grades
Output: The four grades and the average of the four grades.
This is what I have so far:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int grade[4];
int count;
int total = 0;
double average;
for (count = 0; count <= 3; count++)
{
cout << "Enter grade " << count << " ";
{
while(grade[count] < 0.0 || grade[count] > 4.0)
cin >> grade[count];
}
}
for(count = 0; count <= 3; count++)
total = total + grade[count];
average = total/4;
cout << "Your average of four grades are: " << average << endl;
return 0;
}
Thank you so much for your time.