码迷,mamicode.com
首页 > 其他好文 > 详细

例题9.2

时间:2017-04-09 10:41:47      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:pre   stdio.h   style   0.00   wan   div   oat   scanf   exit   

#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

标签:pre   stdio.h   style   0.00   wan   div   oat   scanf   exit   

原文地址:http://www.cnblogs.com/yugangyan/p/6683816.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!