#include <stdlib.h>
double atof(const char *nptr);
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *p1 = "-70.88";
char *p2 = "100e-2";
float ret;
ret = atof(p1) + atof(p2);
printf ("ret = %.2f\n", ret);
return 0;
}
./atof
ret = -69.88
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |