由字符串转为int型...
int strToInt(const char * c)
{
if(c == NULL)
throw "NULL point..";
int sum = 0;
int n = 10;
int flag = 1;
while(*c)
{
if(*c == ' '||*c == '+')
{
c++;
continue;
}
if(*c == '-')
{
flag = -1;
c++;
continue;
}
sum *= n;
sum += *c-'0';
c++;
}
return sum*flag;
}