0

Guys help me how to calculate each student of their grades :(

#include<iostream> using namespace std; int main() { string studname[7] ={"Claire", "Cheska", "Shaira", "Adrian","Aden", "Mark", "Rafael"}; int grade[7][4]= {{90,85,95,91}, {95,80,85,89}, {91,92,97,89}, {85,89,87,92}, {87,92,86,93}, {80,78,77,75}, {81,85,75,87}}; float student_average,sum=0, studs=0; double total_average, average; cout<<"Student Name"<<"\tEnglish\t"<< "Math\t"<< "Science\t"<< "ICT\t"<<"Average\n"; for (int row=0; row<7; row++) { cout<<"\n"<<studname[row]<<"\t\t\t"; studs++; for (int col=0; col<4; col++) { cout<<" "<<grade[row][col]; cout<<"\t"; sum+=grade[row][col]; } cout<<average<<"\n"; student_average=sum/28; } cout<<"\nTotal Number of Student:"<<studs; cout<<"\tTotal Class Average:\t"<<student_average; return 0; }

3rd Nov 2021, 4:58 AM
SAAR MAFFY G.
2 odpowiedzi
+ 4
Simply use loop and access it via indexes inside loop print all the values and pass value of loop in indexes if loop value will be zero Then it will represent first index of studname[loop value] average [loop value] .....
3rd Nov 2021, 5:41 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
can u write it? soryy im noob :(
3rd Nov 2021, 5:58 AM
SAAR MAFFY G.