1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#include <iostream>
#include <string>
int main()
{
int current_count{3};
// 200 STUDENT NAMES
std::string name[200]{"Alice", "Bob", "Carol"};
// 200 MATRIC NUMBERS
int matric_no[200]{1320987, 8723489, 8701255};
// 200 GRADES OF 6 COURSES
int score[200][6]
{
85,65,99,63,87,43,
78,56,98,23,66,74,
99,88,77,66,55,44
};
double average{0};
for(int student = 0; student < current_count; student++)
{
std::cout
<< "Name: " << name[student] << '\t'
<< "matric: "<< matric_no[student] << '\n';
average = 0;
for(int course_no = 0; course_no < 6; course_no++)
{
average += score[student][course_no];
std::cout << score[student][course_no] << ' ';
}
std::cout << "Average: " << average/6.0 << '\n';
}
return 0;
}
| |