用编译器编译——链接、顺利运行程序编译器直接报错
用编译器编译——链接、成功运行程序编译器直接报错
# include <stdio.h>
int main(void)
{
int a,b,c,t;
printf("please enter the three integer \n");
scanf("%d %d %d",a,b,c);
if (a>b)
{;
}
else
{
t=a;
a=b;
b=t;
}
if (a>c)
{;
}
else
{
t=a;
a=c;
c=t;
}
if(c>b)
{
t=b;
b=c;
c=t;
}
printf("%d %d %d \n",a,b,c);
return 0;
}这个小程序实现的是三个整数从大到小排列
还有种更好的写法,
a<b,a<c再把bc比较互换的写法
但我上面的是我的另类写法,编译、链接成功运行成功,输入三个int的整数值以空格隔开,当你敲下回车,编译器会弹出窗口报错要不要发送给微软。
------解决方案--------------------
改为
# include <stdio.h>
int main(void)
{
int a,b,c,t;
printf("please enter the three integer \n");
scanf("%d %d %d",a,b,c);
if (a>b)
{;
}
else
{
t=a;
a=b;
b=t;
}
if (a>c)
{;
}
else
{
t=a;
a=c;
c=t;
}
if(c>b)
{
t=b;
b=c;
c=t;
}
printf("%d %d %d \n",a,b,c);
return 0;
}这个小程序实现的是三个整数从大到小排列
还有种更好的写法,
a<b,a<c再把bc比较互换的写法
但我上面的是我的另类写法,编译、链接成功运行成功,输入三个int的整数值以空格隔开,当你敲下回车,编译器会弹出窗口报错要不要发送给微软。
------解决方案--------------------
scanf("%d %d %d",a,b,c);
改为
scanf("%d %d %d",&a,&b,&c);