![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
K&R C Answer
文章平均质量分 60
tianhellotk
这个作者很懒,什么都没留下…
展开
-
1-5.3 Line Counting (1-8, 1-9, 1-10)
1-8:Write a program to count blanks, tabs, and newlines#include int main(){ int c; int i=j=k=0; while(c=getchar()!=EOF) { if(c==' ')//or if(c==0x20) i++; if(c=='/t') j++; if(c=='/n')原创 2011-03-21 22:11:00 · 261 阅读 · 0 评论 -
1-5.4Word Counting (1-11 ,1-12)
1-11Ques:How do you test the word count program? What kinds of input are most likely to uncover bugs if there are any?Ans:I use a state "IN" or "OUT" to represent the char receiving now is in a word or not, a count for counting words,and a flag stores last原创 2011-03-24 20:02:00 · 302 阅读 · 0 评论 -
1.6 1-13,1-14
1-13pseudocode:read a word , EOF to stopif the word is ' ' or '/t' or '/n'if the pre state is INpush count to a[i]add i oncecount=0if the word is not a ' ' and '/t' and '/n'if the pre state is OUTupdate the state to INadd count onceupdate lasts to state#in原创 2011-03-28 10:01:00 · 188 阅读 · 0 评论