摘要: 我的答案..#include #define Step 20#define Upper 300int transformT (fahr, celsius){ celsius = (5.0 / 9.0) * (fahr - 32.0);return celsius;} main(){int fahr, celsius;for(fahr = 0; fahr #define Step 20#define Upper 300float transformT (float fahr, float celsius);main(){float fahr, celsius;for(fahr = 0; f... 阅读全文
posted @ 2013-10-20 22:44 _Jango 阅读(853) 评论(0) 推荐(0) 编辑
摘要: 由于智商是硬伤..依然是照抄答案。#include #include #define MAXHIST 15#define MAXCHAR 128int main(){int c, i;int len; //length of each bar//int maxvalue; //maximum value for cc[]//int cc[MAXCHAR]; //character counters //for(i = 0; i maxvalue) maxvalue = cc[i];for (i = 1; i 0){ if ((len = cc[i... 阅读全文
posted @ 2013-10-20 14:27 _Jango 阅读(774) 评论(0) 推荐(0) 编辑
摘要: 对题目不太理解 什么事单词长度 什么是直方图,所以选择直接看答案。 ps 不得不承认智商是硬伤....直接复制答案:#include #define MAXHIST 15#define MAXWORD 11#define IN 1#define OUT 0int main(){int c, i, nc, state;int len;int maxvalue;int ovflow;int wl[MAXWORD];state = OUT;nc = 0;ovflow = 0;for (i = 0; i 0) if (nc maxvalue) maxvalue = wl... 阅读全文
posted @ 2013-10-19 12:00 _Jango 阅读(1412) 评论(1) 推荐(0) 编辑
摘要: 我的答案:#include int main(){ int c; while( (c = getchar()) != EOF) if(c == ' ' || c == '\n' || c == '\t') printf("\n"); else putchar(c);}思路 检测到得空格 换行 制表 都用换行代替。答案:#include #define IN 1#define OUT 0int main(){ int c, state; state = OUT; while( (c ... 阅读全文
posted @ 2013-10-19 11:41 _Jango 阅读(1213) 评论(0) 推荐(0) 编辑
摘要: 我的答案:照抄此程序 ,观察运行结果,来测试!初步的测试,nl 即 行数的统计会出现错误,按照\n来计算行数 出容易算少一行,,当我在最后一行的时候 以EOF结束的话,此行将没有计算在内。没有理解好题目,程序并没有错,题目的意思是想让我知道如何的去测试一个程序可能出现的错误!答案:满足边界条件的输入情况, 最有助于发现单词计数程序中的错误......省略顺便把此程序贴上#include #define IN 1#define OUT 0int main(){ int c, nl, nw, nc, state; state = OUT; nl = nw = nc = 0; ... 阅读全文
posted @ 2013-10-18 20:03 _Jango 阅读(2101) 评论(0) 推荐(0) 编辑
摘要: #include int main(){ int c; while((c = getchar()) != EOF) { if(c == '\t') printf("\\t"); if(c == '\b') printf("\\b"); if(c == '\\') printf("\\\\"); if(c != '\t') if(c != '\b') if(c != '\\') putchar(c); }}照搬答案...自己思路太过复杂..没 阅读全文
posted @ 2013-10-18 19:19 _Jango 阅读(1061) 评论(1) 推荐(0) 编辑
摘要: #include #define NONBLANK 'a'int main(){int c, lastc;lastc = NONBLANK;while((c = getchar()) != EOF){ if(c != ' ') putchar(c); if(c == ' ') if (lastc != ' ') putchar(c); lastc = c;}}照搬书上的答案...具体的内涵还没搞懂。 阅读全文
posted @ 2013-10-18 18:18 _Jango 阅读(281) 评论(0) 推荐(0) 编辑
摘要: Test 1-1 运行“hello world ”程序#include int main(){ printf("Hello world!\n");}去掉字符串,int不会报错,,,去掉其余的标点,函数名会报错。Test 1-2 #include int main(){ printf("Hello world!\n\c");}output: Hello world !cTest 1-3#include int main(){ float fahr, celsius; int lower, upper, step; lower = 0; upper = 30 阅读全文
posted @ 2013-10-18 18:12 _Jango 阅读(396) 评论(0) 推荐(0) 编辑
摘要: 感谢师父的引入与教导 end! 阅读全文
posted @ 2013-10-17 23:21 _Jango 阅读(149) 评论(0) 推荐(0) 编辑