统计字符数的问题?
#include <stdio.h>
int main()
{
int n_blank;//统计空格数
int n_enter;//统计换行数
int n_ch;//统计其他字符数
char ch;
while((ch = getchar()) != '#')
{
if(ch == ' ')
n_blank++;
else if(ch == '\n')
n_enter++;
else
n_ch++;
}
printf("%d,%d,%d", n_blank, n_enter, n_ch);
printf("\n");
return 0;
}
输入和输出i'm a writer.
but you not#
1606422586,32768,1606416340
Program ended with exit code: 0
求解这是什么问题?