标签:
#include <stdio.h>
#include <stdlib.h>
int main(){
char *a = "-100.23",
*b = "200e-2",
*c = "341",
*d = "100.34cyuyan",
*e = "cyuyan";
printf("a = %.2f\n", atof(a));
printf("b = %.2f\n", atof(b));
printf("c = %.2f\n", atof(c));
printf("d = %.2f\n", atof(d));
printf("e = %.2f\n", atof(e));
system("pause");
return 0;
}
执行结果:C语言atof()函数:将字符串转换为double(双精度浮点数)
标签:
原文地址:http://www.cnblogs.com/qiuchangyong/p/5323349.html