/*编写一个程序读取输入,读到#字符为止,然后报道读取的空格数,换行符数和所有其他字符的数量。
*/
#include<stdio.h>
int main(void)
{
char ch;
int s_count = 0;
int n_count = 0;
int o_count = 0;
while ((ch = getchar()) != '#') {
switch (ch) {
case ' ':
s_count++;
break;
case '\n':
n_count++;
break;
default:o_count++;
}
}
printf("读取的空格数为%d个,换行符数为%d个,其他字符的数量为%d个。", s_count, n_count, o_count);
return 0;
}