- 博客(10)
- 资源 (1)
- 收藏
- 关注
原创 answer_to_1.24
<br />/* Exercise 1-24. Write a program to check a C program for rudimentary syntax errors like unbalanced parentheses, brackets and braces. Don't forget about quotes, both single and double, escape sequences, and comments. 我只是简单的以数组模拟一个栈的结构,具体算法类似数据结构
2010-12-12 17:23:00
262
原创 answer_to_1.23
/* answer to Chapter1 Exercise 1-23 Write a program to remove all comments from a C program.Don't forget to handle quoted strings and character constants properly.C comments do not nest. 删除形如/*……*的注释语句,若在""中则注意不用删除 经过试验,注释也是可以查到语句中的。 */ #include
2010-12-12 15:32:00
232
原创 answer_to_1.19
<br />/* Exercise 1-19. Write a function reverse(s) that reverses the character string s. Use it to write a program that reverses its input a line at a time. 题目要求将每行逆序输出 这里揣摩笔者之意,应该是不超过MAXLINE 如若超过,同样的,也是总有一个更大的字符串予以存储 就像answer116.cpp中的actual
2010-12-11 14:12:00
271
原创 answer_to_1.18
Exercise 1-18. Write a program to remove trailing blanks and tabs from each line of input, and to delete entirely blank lines.我只实现了前一半功能,至于删除空白行(由于有删除末尾空格的功能,空白行就相当于只有一个'/n'的字符串),easy to slove。#include #define MAXLINE 8 int getline(char s[], int lim)
2010-12-11 14:07:00
321
原创 answer_to_1.17
<br />Exercise 1-17. Write a program to print all input lines that are longer than 80 characters.<br /> <br /> /* 题目要求是打印超过80个字符的一行 为测试简单起见,设定为打印超过8个字符的一行 解决方案是超过8个字就打印出来,但打印当前存储的,但不保留 */ #include <stdio.h> #define MAXLINE 9 int getline(char s[]
2010-12-11 11:30:00
274
原创 answer_to_1.16
Revise 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.#include #define MAXLINE 4 int getline(char s[], int lim) { int c, i; for (i = 0; i
2010-12-10 13:22:00
304
原创 K&R给了我写第一篇博客的冲动
今天开始看K&R的TCPL,发现好多单词都不认识,要么就是不知道意思,要么是计算机专业术语了,不太了解这个领域类的黑话……要多加积累。不妨列出来,已备后面查看,和我一样的菜鸟也可以以此检验一下自己indent truncate substitute augment fraction omitted elimination readily conform interleaved subtle
2010-11-28 18:33:00
270
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人