简单代码 报错 溢出 (本人小白一个)
Run-Time Check Failure #2 - Stack around the variable 'b' was corrupted.
#include <stdio.h>
#define CLEARBUFF scanf("%[^\n]%c")
int main()
{
int a = 0;
int b = 0;
char c = '0';
int d = 0;
printf("请输入 一个数字");
scanf_s("%d",&a);
CLEARBUFF;
printf("请在输入 一个数字:");
scanf_s("%d",&b);
CLEARBUFF;
printf("请输入符号:");
scanf_s("%s",&c,10);
CLEARBUFF;
switch (c)
{
case '/':
d = a / b;
break;
case '+':
d = a + b;
break;
case '-':
d = a - b;
break;
case '*':
d = a * b;
break;
default:
printf("输入字符错误\r\n");
break;
}
printf("结果:%d",d);
}