大神们,新手求指错!!!
从键盘输入三个数,按从小到大顺序输出。编译成功了,但就是不能实现交换的结果。#include "stdio.h"
main()
{
int a,b,c;
int temp1,temp2;
printf("please enter three numbers:\n");
scanf("%d,%d,%d",&a,&b,&c);
if(a>b)
if(a>c)
if(b>c)
{
temp1=b;
b=c;
c=temp1;
}
else if(b<c)
{
temp1=a;
a=b;
c=temp1;
temp2=c;
b=temp2;
}
else if(a<c)
{
temp1=a;
a=b;
b=temp1;
}
else if(a<b)
if(a>c)
{
temp1=a;
a=c;
temp2=b;
b=temp1;
c=temp2;
}
else if(a<c)
if(b>c)
{
temp1=a;
a=b;
temp2=c;
c=temp1;
b=temp2;
}
else
printf("%d<%d<%d",a,b,c);
getch();
}