Hello, i have to do that : Write a program to read class grades from a file (A5Q3.dat - which is given to you) into an array grades and to then output to the screen the following information: Class Average Percentage of grades >= 90 Percentage of grades < 90 and >= 80 Percentage of grades < 80 and >= 65 Percentage of grades < 65 and >= 50 Percentage of grades < 50 Show average and percentages accurate to 2 places after the decimal (xx.xx and xx.xx%). I need to put them into functions, but i will do that if i have the correct code, but can't seem to resolve it. what i was able to do until now is: Code: int main() { int count=0; float score[SIZE]={0}, average, scoretotal=0; string filename; ifstream fin; string line; float avg; fin.open("A5Q3.dat"); if (fin.fail()) cout<<"\nError opening file.\n"; else { cout<<"============================"; cout<<endl; while ( fin.good() ) { getline (fin,line); cout << line<<endl; cout<<endl; while(getline(fin,line)) { //or ( int i=0; i<=SIZE;i++){ int i=0; while(fin>>score[i]) { if(score[i]>90) { // fin>>score[i]; count++; avg=score[i]/count; cout<<"Average>90= "<<avg<<endl; } else if(score[i]<90 || score[i]>=80) { // fin>>score[i]; count++; avg=score[i]/count; cout<<"Average 80-90"<<avg<<endl; } else if(score[i]<90 || score[i]>=80) { // fin>>score[i]; count++; avg=score[i]/count; cout<<"Average 65-80"<<avg<<endl; } else if(score[i]<90 || score[i]>=80) { // fin>>score[i]; count++; avg=score[i]/count; cout<<"Average 50-65"<<avg<<endl; } else if(score[i]<50) { // fin>>score[i]; count++; avg=score[i]/count; cout<<"Average <50"<<avg<<endl; } else cout<<"Error"<<endl; } //END IF