解题思路: 泰克跌了
注意事项:
参考代码:
#includeint rem(int a,int b); int flus(int a, int b); int sub(int a, int b); int mul(int a, int b); int divi(int a, int b); int main() { int a[2]; int(* fff)(int a, int b); //指针函数,适用于同一种类型 char ch; scanf("%d%d", &a[0], &a[1]); getchar(); ch = getchar(); switch (ch) { case '*':fff = mul; break; case '/':fff = divi; break; case '+':fff = flus; break; case'-':fff = sub; break; case '%':fff = rem; } printf("%d", fff(a[0], a[1])); } int flus(int a, int b) { return a + b; } int sub(int a, int b) { return a - b; } int mul(int a, int b) { return a * b; } int divi(int a, int b) { return a / b; } int rem(int a,int b) { return a%b; }
0.0分
0 人评分