鬼火狼烟吧 关注:230贴子:5,304
  • 2回复贴,共1

为什么会这样呢?

取消只看楼主收藏回复

#include "stdafx.h"
int Number=0;

int _tmain(int argc, _TCHAR* argv[])
{   
TCHAR a;
while(1)
{
scanf("%c",&a);
switch(a)
{
case 'a':
case 'A':
Number++;
break;
case 'd':
case 'D':
Number--;
break;
case 's':
case 'S':
                              printf("The Number is %d.\n",Number);
break;
case 'o':
case 'O':
                break;
default:
     printf("Wrong command.\n");
}
if((a=='o')||(a=='O'))
break;
}
getchar();
return 0;
}

运行后,为什么我输入a,会打出Wrong command.??
如下:
a
Wrong command.
s
The Number is 1.
Wrong command.
好象是输入函数的地方出现了问题。大哥,这是为什么呢?


IP属地:湖南1楼2007-05-01 11:43回复
    对了,我用的是VS 2003。Debug和Release版exe的运行结果都是一样的,和我预期的不一样
    为什么呀


    IP属地:湖南2楼2007-05-01 11:45
    回复
      2026-06-27 17:17:59
      广告
      不感兴趣
      开通SVIP免广告
      为什么会产生这样的现象呢


      IP属地:湖南5楼2007-05-03 12:21
      回复