为什么第二个scanf(grade)会报错scanf未传递足够的参数?
#include<stdio.h>
int main()
{
int a;
printf("请输入1或2(等级转分数为1,分数转等级为2)\n");
scanf_s("%d", &a);
char grade;
if (a == 1) {
printf("请输入等级:\n");
scanf_s("%c",&grade,sizeof(grade));
switch (grade)
{
case 'A':
printf("对应分数为90-100");
break;
case 'B':
printf("对应分数为80-89");
break;
case 'C':
printf("对应分数为70-79");
break;
case 'D':
printf("对应分数为60-69");
break;
case 'E':
printf("对应分数为60分以下");
default:
printf("enter date error");
}
}
else
{
int a,b;
printf("请输入你的分数:\n");
scanf_s("%d", &a);
b = a/10;
switch (b)
{
case 10:
case 9:printf("A\n");
break;
case 8:printf("B\n");
break;
case 7:printf("C\n");
break;
case 6:printf("D\n");
break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:printf("E\n");
break;
default:printf("enter date error");
}
}
return 0;