测试LAVA程序。。。死活不通过。。。
#include <stdio.y>#include <math.y>
void main()
{
int a,b,c;
printf("请输入a和b:");
scanf("%d %d",&a,&b);
c=a-b;
if (c<0)
printf("%d<%d",a,b);
if (c>0)
printf("%d>%d",a,b);
if (c==0)
printf("%d=%d",a,b);
} 出错了吗?
提示什么? LZ请看看stdio.y的说明文档,这里的scanf与C语言的scanf的使用方法是不同的!
正确的程序是:#include <stdio.y>
#include <math.y>
void main()
{
int a, b, c;
scanf("请输入a和b:", "%2d%2d", &a);
c = a - b;
if (c < 0) printf("%d < %d", a, b);
else if (c > 0) printf("%d > %d", a, b);
else printf("%d = %d", a, b);
} yan那样写,LZ不知道明白不?
你还是在 &a后面加个 &b算了 哦。。。谢谢yan了。。。
页:
[1]