scanf("%c",&c); // c不是char类型
#include <stdio.h> int main(void) { int a = 0; int b = 0; int res = 0; char op = 0; printf("请输入:"); scanf("%d%c%d",&a, &op, &b); switch (op) { case '+': res = a + b; break; case '-': res = a - b; break; case '*': res = a * b; break; case '/': res = a / b; break; } printf("res = %d ", res); return 0; }