在C语言中使用scanf()获取角色.
问题描述:
{
DWORD input;
int count;
char decision;
printf("Enter the DWORD");
scanf("%x",&input);
printf("\n Enter the counter");
scanf("%d",&count);
printf("\nFor Right-Shift (r) & For Left-Shift (l)\n");
//control not stop here......
scanf("%c",&decision);
if(decision == 'l')
input = input << count;
else
input = input >> count;
printf(" Output :: %x",input);
}
此处程序控制不会在scanf("%c",&decision);
处停止
它采用enter的价值.
Here program control does not stop at scanf("%c",&decision);
It takes value of enter.