c语言用scanf读三个数字,然后按照升序排列.

来源:百度知道 编辑:UC知道 时间:2024/05/31 19:51:52
我还没有学太复杂的东西,刚刚上了几节课程.

#include <stdio.h>
#define INPUT_ONE 9
#define INPUT_TWO 10
#define INPUT_THREE 11

int increaseNum (int a, int b, int c);

int main (int argc, char * argv[]) {

int a=INPUT_ONE
int b=INPUT_TWO
int c=INPUT_THREE;

printf ("Enter three numbers\n");
scanf ("%d%d%d,"&a,&b,&c);

int increaseNum (int a, int b, int c) {
if ((a<=b)&&
(a<=c)&&
(b<=c))
return 这里写不下去了...;
}
}

路过的哥哥姐姐能帮帮忙么?应该用怎样的function写这个小程序呀.谢谢了..
wagner % gcc -Wall -Werror -o increaseNum increaseNum.c
increaseNum.c: In function 'main':
increaseNum.c:14: error: expected ',' or ';' before 'int'
increaseNum.c:18: error: 'b' undeclared (first use in this function)
increaseNum.c:18: error: (Each undeclared identifier is reported only once

刚学几节课就写那么复杂的东西,真是佩服.看看下面这个吧,比较简单.
#include "stdio.h"
main()
{
int a,b,c,t;
printf("please input a,b and c:\n");
scanf("%d%d%d",&a,&b,&c);
if(a>b)
{ t=a,a=b,b=t;}
if(a>c)
{t=a,a=c,c=t;}
if(b>c)
{t=b,b=c,c=t;}
printf("%4d%4d%4d",a,b,c);
}

-------------------------------------------
这样改吧:
#include <stdio.h>
#define INPUT_ONE 9
#define INPUT_TWO 10
#define INPUT_THREE 11

int increaseNum (int a, int b, int c);

int main (int argc, char * argv[]) {

int a=INPUT_ONE;
int b=INPUT_TWO;
int c=INPUT_THREE;

printf ("Enter three numbers\n");
scanf ("%d%d%d", &a,&b,&c);
increaseNum(a,b,c);
}

int increaseNum (int a, int b, int c)
{ int t;
if (a>b){t=a, a=b, b=t;}
if (a>c){t=a, a=c, c=t;}
if (b>