#include main(){int a=0x7fffffff,b=025;float f1=123.456,f2=2

#include
main()
{
int a=0x7fffffff,b=025;
float f1=123.456,f2=2.0;
char c1,c2;
cl='a';
c2='b';
printf("a=%d,b=%dn",a,b);
printf("c1=%c,c2=%cn",c1,c2);
printf("fi=%e,f2=%fn",f1,f2);
a=f1;
b=f2;
printf("a=%d,b=%dn",a,b);
}
D:课件VC6MyProjectsdd.c(5) :warning C4305:'initializing' :truncation from 'const double ' to 'float '
D:课件VC6MyProjectsdd.c(7) :error C2065:'cl' :undeclared identifier
D:课件VC6MyProjectsdd.c(12) :warning C4244:'=' :conversion from 'float ' to 'int ',possible loss of data
D:课件VC6MyProjectsdd.c(13) :warning C4244:'=' :conversion from 'float ' to 'int ',possible loss of data
执行 cl.exe 时出错.
哪里错了请大神指教呀
南山雨农 1年前 已收到1个回答 举报

上等好狗 幼苗

共回答了13个问题采纳率:100% 举报

错误是因为,你定义的char c1,你在下面赋值写的cl,所以error错误是 没有定义cl.至于你发的warning是警告,意思是float转int可能会损失精度.

1年前

4
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 1.033 s. - webmaster@yulucn.com