#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int Add(int x, int y)
{
return x + y;
}
int Mul(int x, int y)
{
return x * y;
}
int Div(int x, int y)
{
return 1.0 * x / y;
}
int Sub(int x, int y)
{
return x - y;
}
int Qum(int x, int y)
{
return x % y;
}
void calc(int(*p)(int, int), int x, int y)
{
int ret = 0;
ret = p(x, y);
printf("%d\n", ret);
}
void All(int* n, int* x, int* y)
{
while (1)
{
if (n == 0)
calc(Add, x, y);
else if (n == 1)
calc(Sub, x, y);
else if (n == 2)
calc(Mul, x, y);
else if (n == 3)
calc(Div, x, y);
else if (n == 4)
calc(Qum, x, y);
else
printf("error");
break;
}
}
int main()
{
int x = 0;
int y = 0;
char mark[5] = "+-*/%";
int n = 0;
char s;
begin:;
scanf("%d%c%d", &x, &s, &y);
for (n;n < 5;)
{
if (mark[n] == s)
{
goto home;
}
else
n++;
}
home:;
int* tn = n;
int* tx = x;
int* ty = y;
All(tn, tx, ty);
printf("输入1继续计算:");
int put = 0;
scanf("%d", &put);
if (put == 1)
goto begin;
return 0;
}