![](https://lstatic.shangxueba.com/jiandati/pc/images/pc_jdt_tittleico.png)
[图] 提示:补充横线上的代码,请使用英文半角输入,不要...
提示:补充横线上的代码,请使用英文半角输入,不要留空格及其他不可见字符。 #include <stdio.h> #include <string.h> int add(int x, int y) { return x + y; } int sub(int x, int y) { return x - y; } int mul(int x, int y) { return x * y; } int div(int x, int y) { return x / y; } int (*func[])(int ,int) = { add,sub,mul,div }; int num, curch; char chtbl[] = "+-*/()="; char corch[] = "+-*/()=0123456789"; int getach() { int i; while (1) { curch = getchar(); if (curch == EOF) return -1; for (i = 0; corch[i] && curch != corch[i]; i++); if (i < strlen(corch)) break; } return curch; } int getid() { int i; if (curch >= '0' && curch <= '9') { for (num="0;" curch>= '0' && curch <= 10 '9'; getach()) num="num" * + curch - '0'; return -1; } else { for (i="0;" chtbl[i]; i++) if (chtbl[i]="=" curch) break; getach(); i; int cal() x1, x2, x3, op1, op2, i="getid();" 4) x1="cal();" op1="getid();" (op1>= 5) return x1; i = getid(); if (i == 4) x2 = cal(); else x2 = num; op2 = getid(); while (!(op2 >= 5)) { i = getid(); if (i == 4) x3 = cal(); else x3 = num; if ((op1 / 2 == 0) && (op2 / 2 == 1)) x2 = (*func[op2])(x2, x3); else { x1 = (*func[op1])(x1, x2); x2 = x3; ____________________; } op2 = getid(); } return (*func[op1])(x1, x2); } void main() { int value; printf("Please input an expression:\n"); getach(); while (curch != '=') { value = cal(); printf("The result is : %d\n", value); printf("Please input an expression:\n"); getach(); } }
![](https://lstatic.shangxueba.com/jiandati/pc/images/jdt_panel_vip.png)
![](https://lstatic.shangxueba.com/jiandati/pc/images/no_answer.png)