当前位置: 首页 > news >正文

Programming abstractions in C阅读笔记: p114-p117

《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)

http://www.lryc.cn/news/126276.html

相关文章:

  • 分布式应用:Zabbix监控Tomcat
  • 《起风了》C++源代码
  • Grafana展示k8s中pod的jvm监控面板/actuator/prometheus
  • 实例038 设置窗体在屏幕中的位置
  • 合成数据及其在AI领域中的作用
  • Java内存区域(运行时数据区域)和内存模型(JMM)
  • 【HDFS】hdfs的count命令的参数详解
  • Lombok注解在JSON化中,JSON生成额外生成字段问题
  • docker中的jenkins之流水线构建
  • ES中倒排索引机制
  • 一生一芯4——使用星火应用商店在ubuntu下载QQ、微信、百度网盘
  • 编程练习(1)
  • pytorch安装VAE项目详解
  • SQL-每日一题【1517. 查找拥有有效邮箱的用户】
  • Python web实战之Django 的 WebSocket 支持详解
  • CDN(内容分发网络)
  • 前端高频面试题 Day01
  • 『C语言初阶』第八章 -隐式类型转换规则
  • Fortinet数据中心防火墙及服务ROI超300%!Forrester TEI研究发布
  • 【vue】简洁优雅的火花线、趋势线
  • 【软件工程】数据流图/DFD概念符号/流程图分层/数据字典
  • 时序预测 | MATLAB实现基于CNN卷积神经网络的时间序列预测-递归预测未来(多指标评价)
  • Python中的字符串与字符编码
  • 图数据库_Neo4j学习cypher语言_使用CQL命令002_删除节点_删除属性_结果排序Order By---Neo4j图数据库工作笔记0006
  • C语言学习笔记---数据的存储详解
  • js中的常见事件(鼠标事件,键盘事件,表单事件......)
  • 学校如何公布录取情况?源代码公布了
  • JAVA基础知识(一)——Java语言描述、变量和运算符
  • 时序预测 | MATLAB实现基于KNN K近邻的时间序列预测-递归预测未来(多指标评价)
  • 冉冉升起的星火,再度升级迎来2.0时代!