1 #include <iostream> 2 #include <assert.h> 3 using namespace std; 4 int ato(const char *str) { 5 int i=0,e=0,s=0; 6 int max=2147483647,min=-2147483648; 7 int f=1; 8 int tem[10]={0}; 9 unsigned int pan=0; 10 while(*str==' '){ //过滤掉连续空格 11 str++; 12 } 13 if(*str=='-'||*str=='+'||(*str<='9'&&*str>='0')){ 14 if(*str=='-'||*str=='+'){ //过滤掉正负号 15 if(*str=='-') 16 f=-1; 17 str++; 18 } 19 while(*str=='0') //过滤掉前面的无用的0 20 str++; 21 if( *str<='9'&&*str>='0' ){ //过滤掉非数字的字符 22 23 while( *str!='