#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
char ch;
printf("Enter value of a and b");
scanf("%d %d",&a,&b);
printf("Enter choice of operation");
scanf("%c",&ch);// **Here this statment is not able to receive my input***
switch(ch)
{
case '+':
c=a+b;
break;
case '-':
c=a-b;
break;
default:
printf("invalid");
break;
}
getch();
}
错误:在C题中扫描字符
scanf("%c",&ch);
// 下面这statment不能接受我的输入 无法扫描用户给定的输入??????
感谢..
'scanf(“%c”,&ch)'会修复它。 – 2011-02-24 19:44:26