forked from pn8rjlxip/System
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
772 B
27 lines
772 B
2 years ago
|
|
||
|
void StatisticAnalysis(STU stu[], int n, int m)
|
||
|
{
|
||
|
int i, j, t[6];
|
||
|
for (j=0; j<m; j++)
|
||
|
{
|
||
|
printf("For course %d:\n", j+1);
|
||
|
memset(t, 0, sizeof(t));
|
||
|
for (i=0; i<n; i++)
|
||
|
{
|
||
|
if (stu[i].score[j]>=0 && stu[i].score[j]<60)t[0]++;
|
||
|
else if (stu[i].score[j]<70) t[1]++;
|
||
|
else if (stu[i].score[j]<80) t[2]++;
|
||
|
else if (stu[i].score[j]<90) t[3]++;
|
||
|
else if (stu[i].score[j]<100) t[4]++;
|
||
|
else if (stu[i].score[j] == 100) t[5]++;
|
||
|
}
|
||
|
for (i=0; i<=5; i++)
|
||
|
{
|
||
|
if (i==0) printf("<60\t%d\t%.2f%%\n",t[i],(float)t[i]/n*100);
|
||
|
else if (i==5) printf("%d\t%d\t%.2f%%\n",
|
||
|
(i+5)*10,t[i],(float)t[i]/n*100);
|
||
|
else printf("%d-%d\t%d\t%.2f%%\n",
|
||
|
(i+5)*10, (i+5)*10+9, t[i], (float)t[i]/n*100);
|
||
|
}
|
||
|
}
|
||
|
}
|