输入两个学生的学号,成绩,输出成绩较高的学生的学号姓名和成绩
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;
}
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;
}
相关文章推荐
- 强化学习-无模型控制(下)
- js 对象借用方法和sessionStorage用法。
- LinkedIn密码是怎么被破解的?
- LinkedIn密码是怎么被破解的?
- 【故障处理】 DBCA建库报错CRS-2566
- 深圳为何留不住中兴、华为?
- 【leetcode】169. Majority Element
- 强化学习-无模型控制(上)
- android上传图片压缩图片大小
- Git使用教程
- 关于WebHDFS与HttpFS
- javascript中闭包的概念
- Unity3d版FlappyBird(像素小鸟)
- 第十四周学习进度
- 设置控件获取焦点
- SQL SERVER 删除前先判断指定的表或者存储过程是否存在
- 结婚后谁管钱更高效?怎样越管越多?
- boost::function
- linux 系统调优2
- 单例模式