C Primer Plus课后题练习
文章平均质量分 75
扳手的海角
这个作者很懒,什么都没留下…
展开
-
15章C Primer Plus详细解答--附带详细注释
15.1#include<stdio.h>#include<limits.h>#include<string.h># include <stdlib.h># include <ctype.h>#define SIZE 33int gets_bstr(char *st, int n);bool check_value(const char *st);int binstr_to_dec(const char *st);int ma原创 2021-04-28 21:18:20 · 754 阅读 · 1 评论 -
c plus第14章-详细解法+注释(欢迎一起讨论,顺带帮助我复习)
14.1#include <stdio.h>#include <string.h>#include <ctype.h>#define LEN 12struct month{ char name[10]; char abbrev[4]; int days; int monnmb;};//创建了一个结构体数组const struct month months[LEN] = { {"January", "Ja原创 2021-02-21 10:29:01 · 4111 阅读 · 0 评论 -
C Primer Plus 第六版(中文版)第十三章(完美版---》加个人注释)编程练习答案
13.1#include <stdio.h>#include <stdlib.h>#define LEN 50int main(int argc, char *argv[]){ int ch; FILE *fp; unsigned long count = 0; char filename[LEN]; printf("Please enter a filename:\n"); scanf("%30s", filename)原创 2021-01-18 09:55:41 · 337 阅读 · 0 评论 -
c primer plus第12章课后题答案(个人详解版)
12.1实参是取地址符,形参使用指针接收#include <stdio.h>void critic(int *units);int main(void){ int units; printf("How many pounds to a firkin of butter?\n"); scanf("%d", &units); while (units != 56) { //调用该函数,再次输入 critic(&units); printf("Y原创 2020-12-30 20:48:57 · 705 阅读 · 0 评论 -
c primer plus第11章答案--个人注释及额外理解版本
11.1采用了do{}while ()的方式//11.1#include <stdio.h>#define LEN 10int main(int argc, char *argv[]){ int i; char input[LEN]; printf("请输入%d个字符(遇EOF停止读取):\n", LEN -1); getnchar(input, LEN - 1); printf("打印结果(包括空白符)是:\n"); puts(input); pr原创 2020-12-02 17:01:16 · 688 阅读 · 4 评论 -
C Primer Plus--第8章 字符输入/输出和输入确认(个人理解+注释版本)
8.1ctrl+z是文件结束符#include <stdio.h>// ctrl+c强制停,ctrl+z是文件结束符//EOF读取到文件结束符停止int main(void){ int ct = 0; int ch; printf("请输入一些字符:\n"); /*当下面的程序运行时, 如果不加" != EOF",那么这个程序就是个死循环,会一直运行下去; 加上" != EOF"后该程序就不是死循环了*/ while ((ch = getchar()) != EOF原创 2020-11-26 10:40:36 · 1015 阅读 · 0 评论 -
C Primer Plus 第六版(中文版)第十章(注释+注意点版)编程练习答案
10.1二维数组使用for循环的嵌套实现计算计算一年当中的月的和,循环时,年走一次,月走12此数组h使用遍历操作*((*(rain + year))+ month) = rain[year][month]#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原创 2020-11-04 19:49:18 · 841 阅读 · 0 评论 -
C Primer Plus第九章练习题编程答案--带错误点
9.11.1#include<stdio.h>double min(double x, double y);int main(){ double x ,y; printf("请输入两个double类型的数"); scanf_s("%lf %lf", &x, &y); printf("你输入的 %g and %g. The min is %g",x, y ,min(x, y)); return 0;}double min(double x, dou原创 2020-10-23 13:16:03 · 415 阅读 · 0 评论 -
C Primer Plus 第六版(中文版)第十四章(14.18.6)编程练习答案-更改版本
去掉len,不在接收read_datas函数的返回值,read_datas函数不在返回整形类型的值#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>#include <string.h>#define LEN 19typedef struct{ int id; //球员的编号 char fname[LEN]; //球员的名; char lname原创 2020-09-30 23:11:25 · 183 阅读 · 0 评论 -
C Primer Plus 第六版(中文版)第十四章(14.18.6)编程练习答案
多次修改终于可以了,数组清零少了Id、姓、名的清零分部走:1、创建一个结构体数组,对数组进行清零,防止有无用数据2、对文本信息进行读取,该球员无上场信息读取下一个球员信息3、计算安打率4、遍历显示读取的文本信息#include <stdio.h>#include <stdlib.h>#include <string.h>#define LEN 19typedef struct{ int id; //球员的编号 cha原创 2020-09-27 16:43:13 · 189 阅读 · 0 评论 -
C Primer Plus 第六版(中文版)第十四章(注释版)编程练习答案(14.18.1-14.18.3)
C Primer Plus 第六版(中文版)第十四章(注释版)编程练习答案欢迎提问交流14.18.1#include<stdio.h>#include<string.h>#include<ctype.h>struct month{ char monthname[10]; char abbrev[5]; int days; int num_month;};const struct month months[12] = { {"January原创 2020-09-09 22:55:12 · 250 阅读 · 0 评论 -
C Primer Plus 第六版(中文版)第十四章(代码注释版)编程练习答案(14.18.4)
14.18.4(a)#include <stdio.h>#include <ctype.h>#include <stdlib.h>#include <string.h>#define N 20#define LEN 30void show(struct person *ptr);struct fullname{ char lastname[N]; char middname[N]; char firstname[N];};s原创 2020-09-10 21:54:53 · 266 阅读 · 0 评论 -
C Primer Plus 第六版(中文版)第十四章(14.18.5)编程练习答案
#include <stdio.h>#include <ctype.h>#include <stdlib.h>#include <string.h>void set_students(struct student ar[], int n);void find_averages(struct student ar[], int n);void show_messages(const struct student ar[], int n);void原创 2020-09-22 23:10:57 · 159 阅读 · 0 评论