0% found this document useful (0 votes)
16 views2 pages

Grade

The document contains C++ code to input exam scores for 4 exams and 3 students into a 2D array, then calculate and output the average score for each student by summing the scores and dividing by the total number of exams.

Uploaded by

atiny thefirst
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Grade

The document contains C++ code to input exam scores for 4 exams and 3 students into a 2D array, then calculate and output the average score for each student by summing the scores and dividing by the total number of exams.

Uploaded by

atiny thefirst
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

/******************************************************************************

grade of

*******************************************************************************/

#include <iostream>

#include <windows.h>

using namespace std;

int main(){

int grade2 [4][3];

int student, exam, avg;

float tscore=0;

for (exam=0; exam <=3; exam++)

cout << "Please enter the score for exam: " <<exam+1 << " : ";

for (student = 0; student <=2; student++)

cout << "Please enter the score for student: " <<student+1 <<" : ";

cin >> grade2[exam][student];

for (exam=0; exam <=3; exam++)

cout << "\n Score for Exam: " <<exam+1 << " : ";

for (student=0; student<=2; student++)

tscore += grade2[exam][student];
avg = tscore/4;

cout << "The average of student# " <<student+1 <<" : " <<avg <<endl;

You might also like