《Programming Abstractions in C》学习第48天,p114-p117,​总结如下:

一、技术总结

主要通过random number介绍了随机数的相关用法,interface​示例(random.h)​,client program示例(craps.c)。

#include <stdio.h>
#include "genlib.h"
#include "random.h" static bool TryToMakePoint(int point);
static int RollTwoDice(void); void main() {
int point; Randomize(); // 定义在自定义的random.h文件中
printf("This program plays a game of craps.\n");
point = RollTwoDice();
switch (point) {
case 7: case 11:
printf("That's a natural. You win.\n");
break;
case 2: case 3: case 12:
printf("That's craps. You lose.\n");
break;
default:
printf("Your point is %d.\n", point);
if (TryToMakePoint(point)) {
printf("You made your point. You win.\n");
} else {
printf("You rolled a seven. You lose.\n");
} }
} static bool TryToMakePoint(int point) {
int total; while (TRUE) {
total = RollTwoDice();
if (total == point) return TRUE;
if (total == 7) return FALSE;
}
} static int RollTwoDice(void) {
int d1, d2, total; printf("Rolling the dice ...\n");
d1 = RandomInteger(1, 6); // 定义在自定义的random.h文件中
d2 = RandomInteger(1, 6);
total = d1 + d2;
printf("You rolled %d and %d -- that's %d.\n", d1, d2, total);
return total;
}

二、英语总结

1.inclusive什么意思?

答:adj. including a particular thing。当讨论涉及到范围时,我们经常会说在某两个数之间,如果包含这两个数,那么就用inclusive这个词来形容这两个数。示例:p114,The first prototype is for the function RandomInteger(low, high), which return a randomly chosen integer in the range between low and high, inclusive。

2.subject to sth语法

答:subject用法最常见的是用作noun,不过subject也可以用作adjective。subject to sth:only able to happen if sth else happen。

三、数学总结

1.区间相关概念

(1) 半开区间: half-open internal

(2) open circle:open circle

(3) 方括号:square bracket

三、参考资料

1.编程

(1)Eric S.Roberts,《Programming Abstractions in C》​:https://book.douban.com/subject/2003414

2.英语

(1)Etymology Dictionary:https://www.etymonline.com

(2)Cambridage Dictionary:https://dictionary.cambridge.org

欢迎搜索及关注:编程人(a_codists)

Programming abstractions in C阅读笔记: p114-p117的更多相关文章

  1. Mongodb Manual阅读笔记:CH3 数据模型(Data Models)

    3数据模型(Data Models) Mongodb Manual阅读笔记:CH2 Mongodb CRUD 操作Mongodb Manual阅读笔记:CH3 数据模型(Data Models)Mon ...

  2. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二十三章:角色动画

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二十三章:角色动画 学习目标 熟悉蒙皮动画的术语: 学习网格层级变换 ...

  3. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十一章:模板测试

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十一章:模板测试 代码工程地址: https://github.co ...

  4. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制 代码工程地址: https://gi ...

  5. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第四章:Direct 3D初始化

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第四章:Direct 3D初始化 学习目标 对Direct 3D编程在 ...

  6. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二章:矩阵代数

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二章:矩阵代数 学习目标: 理解矩阵和与它相关的运算: 理解矩阵的乘 ...

  7. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第一章:向量代数

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第一章:向量代数 学习目标: 学习如何使用几何学和数字描述 Vecto ...

  8. 阅读笔记 1 火球 UML大战需求分析

    伴随着七天国庆的结束,紧张的学习生活也开始了,首先声明,阅读笔记随着我不断地阅读进度会慢慢更新,而不是一次性的写完,所以会重复的编辑.对于我选的这本   <火球 UML大战需求分析>,首先 ...

  9. [阅读笔记]Software optimization resources

    http://www.agner.org/optimize/#manuals 阅读笔记Optimizing software in C++   7. The efficiency of differe ...

  10. 《uml大战需求分析》阅读笔记05

    <uml大战需求分析>阅读笔记05 这次我主要阅读了这本书的第九十章,通过看这章的知识了解了不少的知识开发某系统的重要前提是:这个系统有谁在用?这些人通过这个系统能做什么事? 一般搞清楚这 ...

随机推荐

  1. uni-app 创建项目及目录结构

    文件-新建-1.项目 ┌─uniCloud 云空间目录,阿里云为uniCloud-aliyun,腾讯云为uniCloud-tcb(详见uniCloud) │─components 符合vue组件规范的 ...

  2. MYSQL数据库的创建和删除

    打开Windows命令行,输入登录用户和密码 mysql -h localhost -u root -p 创建新数据 CREATE DATABASE zoo; 查看系统中的数据库 SHOW DATAB ...

  3. 尚医通-day10【微信扫码登录】(内附源码)

    第01章-准备工作 1.申请微信登录 https://open.weixin.qq.com (1)注册开发者账号:准备营业执照 (2)邮箱激活 (3)完善开发者资料 (4)开发者资质认证:1-2个工作 ...

  4. Swift4 入门到精通(第二章基本数据类型与量值)

    第二章 量值和基本数据类型 Swift 支持的基本数据类型, 整型,浮点型,布尔型,元组,可选类型. 学习的目标: 常量与变量的意义.声明.命名规范.类型 数据进制与计算机存储原理 整型数据.浮点型数 ...

  5. .net 项目静态文件自动压缩打包

    打包工具选型 在 ASP.NET MVC 时代,我们常使用 BundleCollection 设置需要打包压缩的 js 和 css 文件,运行时框架会自动处理打包压缩过程并将最终结果传入响应. ASP ...

  6. CKS 考试题整理 (08)-Pod指定ServiceAccount

    Context 您组织的安全策略包括: ServiceAccount 不得自动挂载 API 凭据 ServiceAccount 名称必须以 "-sa" 结尾 清单文件 /cks/s ...

  7. 生成式预训练Transformer:探索其在自然语言处理领域的最新应用

    目录 1. 引言 2. 技术原理及概念 3. 实现步骤与流程 4. 应用示例与代码实现讲解 生成式预训练Transformer:探索其在自然语言处理领域的最新应用 1. 引言 自然语言处理 (NLP) ...

  8. LLM技术在自然语言处理中的实践与改进

    目录 <LLM技术在自然语言处理中的实践与改进> 引言 自然语言处理 (NLP) 是人工智能领域的一个重要分支,它研究如何将计算机程序与人类语言进行交互,从而理解.分析.生成和翻译文本.近 ...

  9. Linux 图形栈从入门到放弃 --- Linux 图形相关概念简介

    PS:要转载请注明出处,本人版权所有. PS: 这个只是基于<我自己>的理解, 如果和你的原则及想法相冲突,请谅解,勿喷. 环境说明   无 前言   在日常生活中,像我们常用的ubunt ...

  10. 【原创】xenomai内核解析-xenomai实时线程创建流程

    版权声明:本文为本文为博主原创文章,未经同意,禁止转载.如有错误,欢迎指正,博客地址:https://www.cnblogs.com/wsg1100/ 目录 问题概述 1 libCobalt中调用非实 ...