首页 > 代码库 > 例题9.2
例题9.2
#include<stdio.h> int main() { struct Student { int num; char name[20]; float score; }student1,student2;//定义结构变量 scanf("%d%s%f",&student1.num,student1.name,&student1.score) ; scanf("%d%s%f",&student2.num,student2.name,&student2.score) ; printf("The higher score is :\n"); if(student1.score>student2.score) printf("%d %s %6.2f\n",student1.num,student1.name,student1.score); else if(student1.score<student2.score) printf("%d %s %6.2f\n",student2.num,student2.name,student2.score); else { printf("%d %s %6.2f\n",student1.num,student1.name,student1.score); printf("%d %s %6.2f\n",student2.num,student2.name,student2.score); } return 0; }
10101 WANG 89
10103 LING 90
The higher score is :
10103 LING 90.00
--------------------------------
Process exited after 16.95 seconds with return value 0
请按任意键继续. . .
例题9.2
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。