标题:一个c语言的问题
取消只看楼主
wangtng03
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-10-28
 问题点数:0 回复次数:0 
一个c语言的问题

#include "stdio.h"
main()
{
int letter=0,space=0,number=0,others=0;
char a;
while(a=getchar()!='\n')
{
if((a>=65&&a<=90)||(a>=97&&a<=122))
{
letter++;
}
else if(a>=48&&a<=57)
{
number++;
}
else if(a==59)
{
space++;
}
else
others++;

}
printf("there are %d letter\n",letter);
printf("there are %d space\n",space);
printf("there are %d number\n",number);
printf("there are %d others\n",others);
}

我本想把输入的字符分类统计出来,可为什么全都加到others上去了

搜索更多相关主题的帖子: c语言 
2007-11-11 23:33



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-185367-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.260488 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved