使用atof需小心

来源:互联网 发布:淘宝直通车效果怎么样 编辑:程序博客网 时间:2024/05/16 06:43

下面的使用方式正常:

float temp = (float)atof(“1.25”);

int  temp1 =  (int)(temp * 100);

下面的使用方式异常:

int temp1 = (int)(atof("1.25")  * 100);