為什么數(shù)字后會(huì)自動(dòng)加小數(shù),且float double 都是六個(gè)零
#include <stdio.h>
int main()
{
??? char c = 97;
??? int n = c;?????? //將c賦值給n
??? float f =c;?????? //將c賦值給f
??? double d = c;???? //將c賦值給d
??? printf("%d\n",n);
??? printf("%f\n",f);
??? printf("%lf\n",d);
??? return 0;???
}
2020-09-21
仔細(xì)看看 float double 是什么類型的
2020-09-21
float, double? 是屬于實(shí)型中的浮點(diǎn)型,float精確到小數(shù)點(diǎn)6~7位,double精確到十幾位,具體可百度,希望對(duì)你有幫助