The C Programming Language第二版第一章习题(部分)
2015-08-16 16:55
537 查看
1.8
编写一个统计空格,制表符与换行符个数的程序
编写一个统计空格,制表符与换行符个数的程序
#include <stdio.h> main(){ int c,nl,tl,kl; nl=tl=kl=0; while( (c=getchar()) != EOF ){ if(c=='\n') ++nl; if(c=='\t') ++tl; if(c==' ') ++kl; } printf("空格 换行符 制表符\n"); printf("%3d %4d %3d",kl,nl,tl); }
相关文章推荐
- HDU 4325-Flowers(线段树+离散化)
- codeforces 570 E. Pig and Palindromes (DP)
- 编写高质量代码改善C#程序的157个建议——建议52:及时释放资源
- hdu 3371 Connect the Cities 最小生成树
- dijkstra算法
- poj 1182
- Spring(Struts、Hibernate优势 + Spring IOC、AOP + Spring实际开发过程)
- 多线程同步之读者写者问题
- 内联(行级)元素不能设置margin-top
- codeforces 250 div2 A B C D
- (树状数组)多校训练7 Segment Game
- 插入排序-直接插入排序、希尔排序
- [转载]2060年软件工程师会像电报报务员那样过时?
- 【LeetCode】257 - Binary Tree Paths
- (1)java虚拟机概念和结构图
- Android LayoutInflater原理分析,带你一步步深入了解View(一)
- Maven的配置文件pom.xml
- ubuntu的recovery mode
- HDU 4908 BestCoder Sequence——BestCoder Round #3
- 初学者MFC下字符串的使用——略解字符体系