作业帮 > 综合 > 作业

输入一行字符,分别统计出其中英文字母、空格

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/28 07:28:54
输入一行字符,分别统计出其中英文字母、空格
# include
int main()
{
int n = 0,char c;

c = getchar ();
if ( c != 0)
n++;
printf("%c\n%d\n",c,n);
return 0;
}
这个程序为什么不是输出每个字符的个数呢?
if ( c != 0)
改为 if ( c != '\r')
#include
void main()
{
\x09int letter, space, number, other;
\x09char ch;
\x09letter = space = number = other = 0;
\x09while((ch = getchar()) != '\n')
\x09\x09if('A'