16进制的简单运算

16进制输入为%x,8进制为%o。

#include<stdio.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b;
        char d;
        scanf("%x%c%x",&a,&d,&b);
        if(d=='+')//字符等于是需要加上单引号
            printf("%o ",a+b);
        else
            printf("%o ",a-b);
    }
    return 0;
}
"No regrets."
原文地址:https://www.cnblogs.com/zxy160/p/7215193.html