简单计算器求助
// 简单四则运算计算器#include<stdlib.h>
#include<stdio.h>
int main()
{
there:
double number1 = 0.0; //初始化被除数
double number2 = 0.0; //初始化除数
char operation = '0';
printf("\n输入算式\n");
scanf("%lf%c%lf",&number1,&operation,&number2); //输入符合规定的算式
/*检查输入的运算符号*/
switch(operation)
{
case '+':
printf("= %lf\n",number1 + number2);
break;
case '-':
printf("= %lf\n",number1 - number2);
break;
case '*':
printf("= %lf\n",number1 * number2);
break;
case '/':
if(number2 == 0)
printf("\n\n除数不能为零!");
else
printf("= %lf\n",number1 / number2);
break;
case '%':
if((long)number2 == 0)
printf("\n\n除数不能为零!!");
else
printf("= %ld\n",(long)number1 % (long)number2);
break;
default:
printf("\n\n非法操作!");
break;
}
fflush(stdin);
char con;
printf("\n继续运算? Y or N \n");
if((con = getchar()) == 'y'||'Y')
goto there;
else
if((con = getchar()) == 'n'||'N')
exit(0);
return 0;
}
输入n之后却无法退出程序,求救