当前位置: > #include...
题目
#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=%d\n",a,b);
printf("c1=%c,c2=%c\n",c1,c2);
printf("fi=%e,f2=%f\n",f1,f2);
a=f1;
b=f2;
printf("a=%d,b=%d\n",a,b);
}
D:\课件\VC6\MyProjects\d\d.c(5) :warning C4305:'initializing' :truncation from 'const double ' to 'float '
D:\课件\VC6\MyProjects\d\d.c(7) :error C2065:'cl' :undeclared identifier
D:\课件\VC6\MyProjects\d\d.c(12) :warning C4244:'=' :conversion from 'float ' to 'int ',possible loss of data
D:\课件\VC6\MyProjects\d\d.c(13) :warning C4244:'=' :conversion from 'float ' to 'int ',possible loss of data
执行 cl.exe 时出错.
哪里错了请大神指教呀

提问时间:2021-03-13

答案
错误是因为,你定义的char c1,你在下面赋值写的cl,所以error错误是 没有定义cl.至于你发的warning是警告,意思是float转int可能会损失精度.
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.