搜索
查看: 1496|回复: 8
打印 上一主题 下一主题

那位GG帮忙看下,我是新手

[复制链接]
跳转到指定楼层
楼主
发表于 2013-6-19 12:20:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
5啊哈币
下面是求三个数最大的,能编译成功,就是不能用啊!!
#include <stdio.h>
#include <windows.h>
int main()
{
int a,b,c,d;
    scanf("%a %b %c",&a,&b,&c);
    if(a>b) d=a;
    else d=b;
    if(d<c) d=c;
    printf("%d",d);
Sleep(5000);
return 0;
}

最佳答案

查看完整内容

你的scanf()格式不正确 %a %b %c 没有这样的 一般是 %d %d %d
沙发
发表于 2013-6-19 12:20:21 | 只看该作者
你的scanf()格式不正确    %a %b %c 没有这样的     一般是  %d %d %d
板凳
发表于 2013-6-19 15:04:23 | 只看该作者
输入有没有遵照scanf中的格式化字符串?
地板
发表于 2013-6-19 21:12:00 | 只看该作者
// 三个数按照从小到大的顺序排序
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
        int t,x,y,z;
   
    printf ("please input three numbers:\n");
   
    scanf ("%d%d%d",&x,&y,&z);
        if (x > y)
    {
                t = x;
        x = y;
        y = t;
    }
    if (x > z)
    {
                t = x;
        x = z;
        z = t;
    }
    if (y > z)
    {
                t = y;
        y = z;
        z = t;
    }
   
    printf ("%d %d %d",x,y,z);
   
        system("pause");
        return 0;
}
5#
发表于 2013-6-19 21:22:01 | 只看该作者
#include <stdio.h>
#include <stdlib.h>
int main()
{
        int a,b,c,t,max;
   
    printf ("please input three numbers\n");
   
    scanf ("%d%d%d",&a,&b,&c);
   
    if (a > b)
                t = a;
    else
                t = b;
    if (t > c)
                max = t;
    else
                max = c;
        printf ("the max number is%d\n",max);
        

        system("pause");
        return 0;
}
6#
发表于 2013-6-19 21:27:17 | 只看该作者
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int a,b,c;
int max;
scanf("%d%d%d",&a,&b,&c);
max=a;
if(max<b) max =b;
if(max<c) max= c;
printf("The max is:%d",max);

        system("pause");
        return 0;
}
7#
发表于 2013-6-19 23:57:21 | 只看该作者
符号有问题
8#
 楼主| 发表于 2013-6-20 11:18:35 | 只看该作者
谢谢各位大哥哥,问题解决了。
9#
发表于 2013-6-20 12:42:24 | 只看该作者
对了,是格式控制符写错了。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

广播台
特别关注
快速回复 返回顶部 返回列表