2013年9月18日

练习1-16:修改打印最长文本行的程序的主程序main,使之可以打印任意长度的输入行的长度,并尽可能多地打印文本(C程序设计语言 第2版)

摘要: 该书英文配套答案Answer to Exercise 1-16, page 30Revise the main routine of the longest-line program so it will correctly print the length of arbitrarily long input lines, and as much as possible of the text. /* This is the first program exercise where the spec isn't entirely * clear. The spec says, ' 阅读全文
posted @ 2013-09-18 18:51 Samuel Yang 阅读(1254) 评论(0) 推荐(0) 编辑

练习1-13:编写一个程序,打印输入中单词长度的直方图(水平)(C程序设计语言 第2版)

摘要: 简单未考虑标点符号#include #define MAX_WORD_LEN 10#define BLANK 0#define IN_WORD 1#define START 2main(){ int c, word_len, last_ch, i, j, len_array[MAX_WORD_LEN+1]; for(i=0; i MAX_WORD_LEN){ len_array[MAX_WORD_LEN]++; }else{ len_array[i-1]... 阅读全文
posted @ 2013-09-18 17:17 Samuel Yang 阅读(417) 评论(0) 推荐(0) 编辑