I am supposed to use an array and a for loop to show the average of these grades. I am not sure the formula for average here and don't know if that is what has me messed up or not. It runs, lets me put in 1 grade and then freezes.
Windows XP (OS)
Microsoft Visual 2003
Error messages: C3861 and C2065 (dealing with line 42)
#include <cctype>
#include <iostream>
#include "stdafx.h"
using std::cout;
using std::cin;
using std::endl;
int _tmain(int argc, _TCHAR* argv[])
{int final[10];
int values[]={67,85,90,89,75,99,92,81,70,62};
int count = 0;
char reply =0;
cout<<endl;
cout<< "The students grades are: 67,85,90,89,75,99,92,81,70, and 62 \n";
cout<<sizeof values/sizeof values[0];
cout<<" The average of these grades is ";
cout<<endl;
int average=0;
cin>>final[count++];
cout<< " Are there any other grades (y/n)? ";
cin>>reply;
while(count<10 && (reply)=='y');
if (count==10)
cout<<endl << "Maximum number of grades has been reached."<<endl;
for(int i=0; i< count ; i++)
cout<<endl<<"The average of the grades is " <<std::setw(10)<<std::setprecision(2)<<std::fixed<<(static_cast<double>(total)/count)<<endl;
return 0;
}
I am sorry to sound so illiterate, but the instructor in my class does not give any support, or feedback. We were given a book and thrown in head first. I am new (very green) to this and I am completely lost!
Thanks for any help!
T