谁能帮我看看我这个问题
目的是输入数字,求出数字的个数,可是我的结果都是0,谁能帮我看看有什么问题,多谢了#include<stdio.h>
int main(void)
{
int a=0;
char ch;
printf("enter letter:");
ch=getchar();
if(ch>=0&&ch<=9){
a=a+1;
ch=getchar();
printf("%d\n",a);
}
}
2010-01-23 20:40
2010-01-23 21:38
2010-01-23 21:51
2010-01-23 22:29


2010-01-23 22:43
2010-01-23 23:04
程序代码:#include<stdio.h>
main()
{
int a=0;
char ch;
printf("enter letter:");
while((ch=getchar())!='\n')
{if(ch>='0'&&ch<='9')
a=a+1;
}
printf("%d",a) ;
getch();
}
2010-01-24 00:18




小弟多谢各位了,呵呵

2010-01-24 14:00
2010-01-25 17:47