float x;
char *s = "7.2339 by these hilts or I am a villian else";
char *s = "7.2339 by these hilts or I am a villian else";
x = atof(s);
/* The %.2f formatting string limits the output to 2 decimal places */
lr_output_message("%.2f", x);
/* The %.2f formatting string limits the output to 2 decimal places */
lr_output_message("%.2f", x);
应输出:7.23
实际输出为:1244128.00(此值各个机器运行结果可能不同)
实际输出为:1244128.00(此值各个机器运行结果可能不同)
本文转自 fish_yy 51CTO博客,原文链接:http://blog.51cto.com/tester2test/137381,如需转载请自行联系原作者