C Primer Plus碎碎念
slamx
毕业没选择作coder之后终于发现自己对coding的热情,以及对现在无趣工作的厌倦。
展开
-
c prime plus第十四章练习题
1.#include <stdio.h> #include <ctype.h>#include <string.h>int days(char *p);struct month{ char name[10]; char abbrev[4]; int days; int monumb;};struct month months[12] = { {"janu原创 2015-10-02 21:10:35 · 621 阅读 · 0 评论 -
C primer plus 第十章
编程练习1.#include <stdio.h>#define MONTHS 12#define YEARS 5int main(void){ const float rain[YEARS][MONTHS] = { {4.3,4.3,4.3,3.0,2.0,1.2,0.2,0.2,0.4,2.4,3.5,6.6}, {8.5,8.2,1.2,1.6,2.4,0.0,5原创 2015-08-19 23:51:20 · 530 阅读 · 0 评论 -
c prime plus 第十二章
1.#include <stdio.h>void critic(int *p);int main(void){ int units; printf("How many pounds to a firkin of butter?\n"); scanf("%d",&units); while(units != 56) critic(&units);原创 2015-09-08 19:58:23 · 740 阅读 · 0 评论 -
c prime plus第八章
编程练习1.#include <stdio.h>int main(void){ int count = 0; while(getchar() != '\n') { count++; } printf("There are %d chars.\n", count); return 0;}2.#include <stdio.h>in原创 2015-07-21 13:43:08 · 644 阅读 · 0 评论 -
C Primer plus 第九章
编程练习1.#include <stdio.h>double min(double, double);int main(void){ double a, b; printf("Enter two double:"); scanf("%lf %lf", &a, &b); printf("The smaller is %lf.\n", min(a,b)); r原创 2015-07-30 20:03:15 · 684 阅读 · 0 评论 -
C primer plus第七章习题
复习题很轻松的通过了,不赘述了。 最近工作开始忙了,第七章看的效果很慢,但是兴趣还在上了24小时的班之后居然能兴致勃勃的写代码,当做休息吧。 瞎扯结束,以上。编程练习1./很简单,看会书上例题就可以。/ #include 2.#include <stdio.h>int main(void){ char ch; int n; for( n = 1;ch原创 2015-07-14 15:34:09 · 944 阅读 · 0 评论 -
C Primer Plus 第五章习题
复习题1.a. x=30 b. x=27 c. y=1 x= 1 d. y=9 x=32.a. x=6 b. x=52 c. x=0 d. x= 133.#include <stdio.h>int main(void){ int i = 1; float n; printf("Watch out!Here come a bunch of fractions!\n原创 2015-06-11 22:45:17 · 560 阅读 · 0 评论 -
C Prime plus 第六章习题
突然觉得复习题答案不需要那么详细了,只给出本人不懂或者做错的题,把解题思路写出来。希望这样可以学习提高效率。 第六章讲循环语法,谢天谢地,学会python之后,再回顾C,循环再也没有python中的语法糖了,虽然简洁,但是语法糖真是对新手不太友好的黑魔法。while,for,do while都还算友好。复习题6.嵌套语句生成$矩阵#include <stdio.h>int main(void原创 2015-06-27 19:12:37 · 1112 阅读 · 5 评论 -
C Primer plus 第四章
复习题:1.程序无法继续工作,输入的内容由名字变成姓与名之后,scanf函数只能读取姓(中国习惯),名被保留在了缓冲区,导致第二个输入的体重无法读取,只能去读取缓冲区的名,名不是十进制的整数,导致程序无法正常工作。2.a.He sold the painting for $2.34. b.Hi! c.His Hamlet was funny without being vulgar.原创 2015-06-08 23:34:59 · 859 阅读 · 0 评论 -
C Prime Plus第十三章
1.#include <stdio.h>#include <stdlib.h>int main(void){ char name[41]; int ch; FILE *fp; long count = 0; printf("Input the file's name: "); scanf("%s", &name); if((fp = fope原创 2015-09-21 20:02:12 · 775 阅读 · 0 评论