在C语言中使用scanf()获取角色.

在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.

不要在多个论坛中发布相同的问题!您已经警告发布了此问题,并在此处 [ ^ ]
Don''t post the same question in multiple forums! You have alredy posted this question and received an answer here[^]