struct Student
{
char cName[20];
float fScore[3];
}student = { "憨批",98.5f,88.0,93.5f };
void Display(struct Student stu)
{
printf("Name:%s\n", stu.cName);
printf("Chinese:%s\n", stu.fScore[0]);
printf("Math:%s\n", stu.fScore[1]);
printf("English:%s\n", stu.fScore[2]);
printf("Average score:%.2f\n", (stu.fScore[0] + stu.fScore[1] + stu.fScore[2]) / 3);
}
int main()
{
Display(student);
return 0;
}
结构体输出学生成绩
最新推荐文章于 2022-11-03 10:52:10 发布