您的位置:首页 > 其它

输入两个学生的学号,成绩,输出成绩较高的学生的学号姓名和成绩

2016-06-05 20:01 585 查看
#include<stdio.h>

int main()

{
struct Student
{
long int num;
char name[20];

        float score;
} student1,student2;
scanf("%ld%s%f",&student1.num,student1.name,&student1.score);
scanf("%ld%s%f",&student2.num,student2.name,&student2.score);
printf("The higher score is:\n");
if(student1.score>student2.score)
printf("%ld  %s  %f\n",student1.num,student1.name,student1.score);
else if(student1.score<student2.score)
printf("%ld  %s  %f\n",student2.num,student2.name,student2.score);
else
{
printf("%ld  %s  %f\n",student1.num,student1.name,student1.score);
   printf("%ld  %s  %f\n",student2.num,student2.name,student2.score);
}
return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: