数字输入输出挂

int Scan()
{
    int res=0,ch,flag=0;
    ch=getchar();
    while(ch=='\n'||ch==' ') ch=getchar();
    if(ch=='-')
        flag=1;
    else if(ch>='0'&&ch<='9')
        res=ch-'0';
    while((ch=getchar())>='0'&&ch<='9')
        res=res*10+ch-'0';
    return flag?-res:res;
}

void Out(int a) 
{
    if(a>9)
        Out(a/10);
    putchar(a%10+'0');
}

你可能感兴趣的:(数字输入输出挂)