#define _CRT_SECURE_NO_WARNINGS 1#include<stdio.h> #include <stdlib.h> #include <assert.h >int int_computer (int num1, char *p, int num2) { if (p == "-A") return num1 + num2; else if (p == "-S") return num1 - num2; else if (p == "-M") return num1 * num2; else if (p == "-D") return num1 / Num2; else return -1;} Int main (INT&NBSP;ARGC,INT&NBSP;ARGV) { char a; char *p = &a; int &NBSP;NUM1&NBSP;=&NBSP;0;&NBSP;INT&NBSP;NUM2&NBSP;=&NBSP;0;&NBSP;SCANF ("%d%c%d", &num1, &a, &NBSP;&NUM2); if (a == ' + ') p = "-a"; // If the input ' + ' means "-a" option to perform addition else if (a == '-') p =&nbsP; " -S "; //if input '-' indicates"-S "option to perform subtraction else if (a == ' * ') p = "-M"; //if input ' * ' means '-m ' option to perform multiplication else if (a == '/') p = "-D"; //if the input '/' means "-d" option to perform division else p = int ret = int_computer (num1, p, num2); printf ("%d%c%d=%d\n", num1, a, num2, ret); system ("pause"); return 0;}
"C" "Face question" using the parameters of the main function to implement an integer computer, the program can accept three parameters