1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include "stdio.h"
int main()
{
struct stu
{
char name[16];
float english, chinese, math;
};
struct stu student[3] = {
{"张三", 80, 90, 60},
{"李四", 60, 90, 60},
{"王五", 50, 90, 60}
};
int i = 0;
for (; i < 3; i++)
printf("%s的平均成绩是%.2f\n", student[i].name,
(student[i].english + student[i].chinese + student[i].math) / 3);
return 0;
}
|