| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 803 人关注过本帖
标题:看程序,不知道哪里错了,得不到结果
取消只看楼主 加入收藏
孙娜娜
Rank: 2
等 级:论坛游民
帖 子:49
专家分:22
注 册:2012-3-5
结帖率:93.75%
收藏
已结贴  问题点数:20 回复次数:1 
看程序,不知道哪里错了,得不到结果
//输出成绩较高学生的学号,姓名和分数
#include<stdio.h>
int main()
{
    struct Student
    {
        int num;
        char name[20];
        int score;
    }student1,student2;
     scanf("%d,%s,%d",&student1.num,&student1.name,&student1.score);
    scanf("%d,%s,%d",&student2.num,&student2.name,&student2.score);
    printf("The higher score is:\n");
    if (student1.score>=student2.score)
        printf("%d,%s,%d\n",student1.num,student1.name,student1.score);
               else
               printf("%d,%s,%d\n",student2.num,student2.name,student2.score);
               return 0;



           }
搜索更多相关主题的帖子: include 姓名 higher 
2012-06-02 20:14
孙娜娜
Rank: 2
等 级:论坛游民
帖 子:49
专家分:22
注 册:2012-3-5
收藏
得分:0 
回复 2楼 nzxiansheng
为什么把scanf改为:scanf("%d,%d,%s",&student1.num,&student1.score,student1.name);
                    scanf("%d,%d,%s",&student2.num,&student2.score,student2.name);
就可以了呢???      
      
2012-06-02 20:38
快速回复:看程序,不知道哪里错了,得不到结果
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011776 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved