c语言中,定义一个学生结构体类型,包括学号、姓名、性别、年龄、2门课成绩,定义两个子函数,定义

2024-11-17 23:55:07
推荐回答(1个)
回答(1):

printf("please input the second student name:\r\n");
scanf("%s", b.name);

printf("please input the second student sex:\r\n");
scanf("%s", b.sex);

printf("please input the second student age:\r\n");
scanf("%d", &b.age);

printf("please input the second student score:\r\n");
scanf("%d", &b.score);

if(a.score >= b.score)
pStudent = &a;
else
pStudent = &b;

printf("the score higher student info:\r\n");
printf("name = %s, sex = %s, age = %d, score = %d\r\n", pStudent->name, pStudent->sex, pStudent->age, pStudent->score);

return 0;
}