warning C4244: '=' : conversion from 'float ' to 'int ', possible loss of da
#include<stdio.h>main(){inta=0x7fffffff,b=025;floatf1=123.456,f2=2.0;charc1,c2;cl='a'...
#include <stdio.h>
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 时出错.
哪里错了请大神指教呀 展开
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 时出错.
哪里错了请大神指教呀 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询