文字输入可以想到用堆栈(先接受高位数)
`
int tans(char *S)
{
int sum = 0;
int i = 0;
while (isdigit(S[i]))
{
sum = sum * 10 + (S[i++] - '0');
}
return sum;
}
`
`
int tans(char *S)
{
int sum = 0;
int i = 0;
while (isdigit(S[i]))
{
sum = sum * 10 + (S[i++] - '0');
}
return sum;
}
`