Can any body correct it


#1

int Solution::atoi(const string A) {
int n=A.size();
int result=0;
int temp=1;

for(int i=0;i<n;i++)
{
   if(A[0]=='+') continue;
   else if(A[0]=='-') { temp=-1 ; continue;}
    else if(A[i]-'0'<=9&&A[i]-'0'>=0)
    {
        result=(result*10)+(A[i]-'0');
    }
    else break;
}
return temp*result;

}