/*引用"air5116"改写计算器c4droid*/
#include "stdio.h"
#include "math.h"
void main()
{
v: printf
(" *********************\n");
printf
(" ** 1.加法运算 **\n");
printf
(" ** 2.减法运算 **\n");
printf
(" ** 3.乘法运算 **\n");
printf
(" ** 4.除法运算 **\n");
printf
(" ** 5.求余运算 **\n");
printf
(" ** 6.累加运算 **\n");
printf
(" ** 7.阶乘运算 **\n");
printf
(" ** 8.退出 **\n");
printf
(" *********************\n");
printf
(" 请选择功能:");
int a, b, c, d, e, f, g, t, j;
scanf("%d", &e);
if (e != 6&&e != 7&&e != 8)
{
printf("请输入两个数字\n");
scanf("%d", &a);
scanf("%d", &b);
}
else
switch (e)
{
case 1:
c = a + b;
goto a;
case 2:
c = a - b;
goto a;
case 3:
c = a * b;
goto a;
case 4:
c = a / b;
goto a;
case 5:
c = a % b;
goto a;
case 6:
b:printf("零+回车结束\n请输入数字\n");
scanf("%d", &d);
c = c + d;
if (d == 0)
goto a;
else
goto b;
goto a;
case 7:
printf("请输入一个数字\n");
scanf("%d", &g);
if (g <= 0)
printf("无解\n");
else
{
for (int i = 1; i <= g; i++)
t *= i;
goto a;
}
}
a:printf("结果为:%d", c);
printf("%d!=%d\n", g, t);
printf("\n\n\n\n\n>>>>1菜单\n>>>>2退出\n");
scanf("%d", &j);
if (j == 1)
goto v;
else
printf("请点击关闭\n");
}