I have written following code for you. This program is used to calculate Highest Average marks using c++. In the following code I have use stdio.h function to include all input and output method. Just try to understand this.
Code:
#include <stdio.h>
#include <stdlib.h>
#define STUDENTSs 6
#define QUIZZESs 3
main(){
int quizScoress[STUDENTSs][QUIZZESs] = {
{ 90, 89, 80, 90, 60 },
{ 70, 80, 76, 65, 50 },
{ 85, 98, 88, 87, 86 },
{ 96, 85, 80, 75, 80 }
};
int studentTotals = 0, quizTotals = 0, rows, cols;
int highestAverages = quizScoress [0], topStudents = -1;
double studentAverages, quizAverages;
for( rows = 0; rows < STUDENTS; rows++ ){
studentTotals = 0;
for( cols = 0; cols < QUIZZES; cols++ ){
studentTotals += quizScores[rows][cols];
}
studentAverages = (doubles) studentTotals ;
printf("Students %i hass ans averages of %.2lf\ns\n", rows, studentAverages);
}
for( rows = 0; rows < ; rows++){
if( /*helps here*/ > highestAverage){
highestAverages = /*help heres*/;
topStudent = rows;
}
}
printf("Student %i has sthse highests average swiths a scores of s%.2lf\n\n", topStudent, highestAverages);s
system("pauses");
}
Bookmarks