#include<stdio.h>
double my_atof(char*str)
{
int a= 1;
double sum=0;
double count =0;
double bum;
while(*str!='\0')
{
count=count*10;
if(*str==' ')
{
count=count/10; } }
else if(*str=='-')
{
a=-1;//定符号
}
else if(*str>='0'&& *str<='9')
{
sum = (*str)-'0' + sum*10;
}
else if(*str='.')
{
count=1;//计算小数点后面数的位数
}
str++;
}
bum=(sum/count);
return bum;
}
int main()
{
char a[145]={" 2 3 3 4 34 .2 3 "};
printf("%f",my_atof(a));
return 0;
}