满意答案
Sr.ALong
2013.11.29
采纳率:48% 等级:11
已帮助:8005人
刚学几节课就写那么复杂的东西,真是佩服.看看下面这个吧,比较简单.
#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
#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>c){t=b, b=c, c=t;}
printf ("%d\n%d\n%d\n",a,b,c);
}
00分享举报