看我这段C是什么问题

来源:百度知道 编辑:UC知道 时间:2024/06/07 18:38:59
main()
{
int x,y;
printf("shu ru\n");
scanf("%lf%lf",&x,&y);
printf("this is %lf other is%lf\n",x,y);
system("PAUSE");
}
显示:
shu ru scanf:floating point formats not linked
而把%lf换成%d又能正常显示 是怎么回事啊
麻烦各位了
嘿嘿 见笑了
我是业余的 自然很差
那dobule int各是什么意思啊?

……
c语言的常识题
定义的类型有对应的输入形式的!
%lf是dobule型的!
%d是int型的!

你定义的X,Y是整型,输出当然得是整型了。

int型对应%d
double型对应%f

...用%d啊 你基础没打好吧。。

这个就是 数据类型的问题与转义说明的问题

%f是浮点型常量 你之前定义是INT 所以是%d

main()
{
int x,y;//这块定义的是int
printf("shu ru\n");
scanf("%lf%lf",&x,&y);//这块scanf的是double
printf("this is %lf other is%lf\n",x,y);
system("PAUSE");
}
//scanf:floating point formats not linked
//所以给了浮点格式化不匹配的re