C语言编程,调试时弹出来debug error,而且是运行到一半弹出来的,我用的是VS,哪位大神能帮我看看?
#include<stdio.h>voidmain(){inta,c,d,e,i=1,w;charb,x;do{printf("请出题:");scanf("%d%c%d=...
#include<stdio.h>
void main()
{
int a, c, d, e, i = 1, w;
char b, x;
do
{
printf("请出题:");
scanf("%d%c%d=%d", &a, &b, &c, &d);
switch (b)
{
case '+':e = a + c; break;
case '-':e = a - c; break;
case '*':e = a * c; break;
case '/':e = a / c; break;
default:printf("输入有错,请重新输入。\n");
}
do
{
if (e == d)
{
printf("很好,做对了!\n");
break;
}
else
{
printf("做错了,再做一次!\n");
scanf("%d", &d);
}
i++;
} while (i <3);
if (e == d)
{
if (i == 2)
{
printf("很好,做对了!\n");
}
printf("是否继续?(yes/no)\n");
scanf("%c", &x);
switch (x)
{
case 'y':w = 1; break;
case 'n':w = 0; break;
}
}
else
{
printf("正确答案为%d\n", e);
printf("是否继续?(yes/no)\n");
scanf("%c", &x);
switch (x)
{
case 'y':w = 1; break;
case 'n':w = 0; break;
}
}
} while (w == 1);
} 展开
void main()
{
int a, c, d, e, i = 1, w;
char b, x;
do
{
printf("请出题:");
scanf("%d%c%d=%d", &a, &b, &c, &d);
switch (b)
{
case '+':e = a + c; break;
case '-':e = a - c; break;
case '*':e = a * c; break;
case '/':e = a / c; break;
default:printf("输入有错,请重新输入。\n");
}
do
{
if (e == d)
{
printf("很好,做对了!\n");
break;
}
else
{
printf("做错了,再做一次!\n");
scanf("%d", &d);
}
i++;
} while (i <3);
if (e == d)
{
if (i == 2)
{
printf("很好,做对了!\n");
}
printf("是否继续?(yes/no)\n");
scanf("%c", &x);
switch (x)
{
case 'y':w = 1; break;
case 'n':w = 0; break;
}
}
else
{
printf("正确答案为%d\n", e);
printf("是否继续?(yes/no)\n");
scanf("%c", &x);
switch (x)
{
case 'y':w = 1; break;
case 'n':w = 0; break;
}
}
} while (w == 1);
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询