《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. 2020-03-01:给定一个非负数组arr,代表直方图。返回直方图的最大长方形面积。

    2020-03-01:给定一个非负数组arr,代表直方图.返回直方图的最大长方形面积. 福哥答案2020-03-01: 单调栈,大压小.有代码. 代码用golang编写,代码如下: package m ...

  2. PTA L1-064 估值一亿的AI核心代码

    PTA L1-064 估值一亿的AI核心代码 有坑!不少 题目链接 题目及分析 题目: 本题要求你实现一个稍微更值钱一点的 AI 英文问答程序,规则是:       1. 无论用户说什么,首先把对方说 ...

  3. SpringMVC 后台从前端获取单个参数

    1.编写web.xml(模板) 2.springmvc配置文件 3.编写对应数据库字段的pojo实体类 @Data @AllArgsConstructor @NoArgsConstructor pub ...

  4. Java 网络编程 —— 创建非阻塞的 HTTP 服务器

    HTTP 概述 HTTP 客户程序必须先发出一个 HTTP 请求,然后才能接收到来自 HTTP 服器的响应,浏览器就是最常见的 HTTP 客户程序.HTTP 客户程序和 HTTP 服务器分别由不同的软 ...

  5. 蜂窝移动通信(IOT)接入流程

      蜂窝物联网   蜂窝物联网(Cellular IoT)就是使用现有的蜂窝网络连接物联网设备而形成的物联网,是一种将物理设备与互联网连接起来的方式.通过蜂窝物联网,人们将一些物理设备--如传感器-- ...

  6. 【pandas基础】--目录(完结)

    pandas 基础内容的目录: 概述 pandas 主要功能和应用场景的介绍. 数据读取 数据读取是第一步,只有成功加载数据之后,后续的操作才有可能. pandas 可以读取和导入各种数据格式的数据, ...

  7. celery笔记三之task和task的调用

    本文首发于公众号:Hunter后端 原文链接:celery笔记三之task和task的调用 这一篇笔记介绍 task 和 task 的调用. 以下是本篇笔记目录: 基础的 task 定义方式 日志处理 ...

  8. 前后端是怎么交互的呢?(Jvav版)

    一.什么是前端 在网上,我也去找了一些观点,其实都是应用层面的,什么使用一个地址,回车以后就能拿到 .html文件等等 说的也没问题,前端简单点说呢,就是负责展示和美化的页面,大部分在网上我们所看到的 ...

  9. mysql主从-主主架构设计

    前言: 1. mysql主从.主主复制应用场景很多,其原理主推,从定时根据binlog增量拉取更新 2. 如果主/从机器硬件负载过高,或者网络延迟就会造成同步延迟 3. 延迟是必然,mysql复制同步 ...

  10. Prometheus-2:blackbox_exporter黑盒监控

    黑盒监控blackbox_exporter 前边介绍有很多exporter可以直接将metrics暴露给Prometheus进行监控,这些称为"白盒监控",那些exporter无法 ...