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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
#include<iostream>
#include<iomanip>
using namespace std;
#define n 10
double find_average(double );
void storeArray(double);
void display_grade();
void find_highest();
double storeAverage[n];
const int No_matric=10;
const int matricNo=7;
const int row_Scores=10;
const int col_Scores=3;
double average,total,arrays;
int row;
int col;
char noMatrix[No_matric][matricNo] ={"BC0123","BC1234","BC2345","BC3456","BC4567","BC5678","BC6789","BC7890","BC8900","BC9999"};
double scores[row_Scores][col_Scores]={{84.2,86.4,79.8},{93.2,87.4,65.4},{86.0,83.5,84.5},{30.0,50.5,80.2},{54.9,78.8,90.3},
{45.7,63.8,50.2},{78.4,47.6,68.7},{88.8,73.2,87.6},{78.7,40.3,59.6},{67.9,77.8,90.1}};
int main()
{
cout<<"\tBITP1113 : Students' Performance Report"<<endl;
cout<<"\t---------------------------------------"<<endl;
cout<<" Matric no.\tTest1\tTest2\tTest3\tAverage Grade\t"<<"Highest Score"<<endl;
cout<<" ---------\t-----\t-----\t-----\t------- -----\t-------------"<<endl;
for(row=0; row<10;row++)
{
cout<<"\n"" "<<noMatrix[row]<<"\t";
for(int col=0;col<3;col++)
{
cout<<"\t"<<setprecision(2)<<fixed<<scores[row][col];
}
average = find_average(average);
cout<<setprecision(2)<<fixed<<" \t "<<average<<"\t ";
display_grade();
find_highest();
}
return 0;
}
double find_average(double average)
{
{
double total;
total =scores[row][0]+scores[row][1]+scores[row][2];
average= total/3;
}
return average;
}
void display_grade()
{
if(average>=80 && average<=100)
cout<<" A"<<endl;
else if (average>=70 && average<=79.9)
cout<<" B"<<endl;
else if(average>=60 && average<=69.9)
cout<<" C"<<endl;
else if (average>=40 && average<=59.9)
cout<<" D"<<endl;
else
cout<<" E"<<endl;
}
void find_highest()
{
int b;
double largest, storeAverage[n];
largest=scores[row][col];
for(b=0;b<3;b++)
{
if (largest<=scores[row][b])
{
largest=scores[row][b];
}
}
cout<<largest<<endl;
}
|