#include <stdio.h>
struct s
{
int num;
char name[10];
float score;
};
int main(void)
{
struct s stu[5] = {
{1,"xiaozhao",50.5},
{ 2, "xiaoqian", 60.5 },
{ 3, "xiaosun", 75.5 },
{ 4, "xiaoli", 15.5 },
{ 5, "xiaozhou", 15.5 }
};
float var = 0.0f;
for (int i = 0; i < 5; i++)
{
printf("学号: %d\t姓名: %s\t成绩:%.2f\n", stu[i].num, stu[i].name, stu[i].score);
var += stu[i].score;
}
var /= 5;
printf("平均分: %.2f\n", var);
return 0;
}
温馨提示:内容为网友见解,仅供参考