/*
编写一个统计空格,制表符与换行符个数的程序
*/
#include <stdio.h>
int main()
{
int ch,countSpace,countTable,countEnter;
countSpace = countTable = countEnter = 0;
while((ch = getchar()) != EOF)
{
if(ch == ' ')
++countSpace;
else if(ch == '\t')
++countTable;
else if(ch == '\n')
++countEnter;
}
printf("space:%d\ntable:%d\nenter:%d\n",countSpace,countTable,countEnter);
return 0;
}
练习 1- 8 编写一个统计空格,制表符与换行符个数的程序
最新推荐文章于 2022-09-05 08:24:17 发布