Ϊʲôһֱ±¨´í£¬ÄÄλ´óÉñÖ¸µãÒ»ÏÂ
#include <stdio.h>void main()
{
float t,s;
scanf("%f",&t);
s=1.0/2*9.8*t*t;
printf("ÏÂÂä¾àÀëΪ=%f\n",s);
}
Ϊʲôһֱ±¨´í£¬ÄÄλ´óÉñÖ¸µãһϠH:\ϵͳĬÈÏ\×ÀÃæ\ѧϰ\CÓïÑÔ\³ÌÐò\ÔÝ´æ\1\1.c(6) : warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
ÕâÊDZ¨´íÐÅÏ¢£¬¸Õѧ¿´²»¶®{:10_266:} Õâ¸öÖ»ÊÇÊý¾ÝÒç³ö£¬¿ÉÒÔ°Ñfloat¸ÄΪdouble£¬%f¸ÄΪ%lf¡£ Ö»ÊÇwarning£¬¿ÉÒÔÔËÐÐ
´íÎóÊÇerror
ÏëÒª¸ü¾«È·¿ÉÒÔÓÃdoubleÀ´½ÓÊÕ½á¹û µ¥¾«¶È float
Ë«¾«¶È double
ÄãÓÃdoubleÊÔÊÔ
Ò³:
[1]