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

这篇具有很好参考价值的文章主要介绍了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)文章来源地址https://www.toymoban.com/news/detail-659318.html

到了这里,关于Programming abstractions in C阅读笔记: p114-p117的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Programming Abstractions in C阅读笔记:p242-p245

    《Programming Abstractions in C》学习第67天,p242-p245总结,总计4页。 6.2小结主要讲回溯算法及递归算法在迷宫求解中应用,当然,理解然后用代码实现出来还是有些难度的。不过,这并不影响我们进行下一节6.3的学习。 答: (1)skepticism: skeptic + -ism。u. doub that sth is true or useful,怀

    2024年02月02日
    浏览(27)
  • 【论文阅读笔记】Endoscopic navigation in the absence of CT imaging

      上一篇的导航导论,是需要先验,也就是需要事先拍摄堆叠的图片(比如CT图等),在体外构建相应的3D模型,再与内窥镜图像进行实时匹配。对于很多情况来说,是无法拥有如此充足的先验的。所以,本文探索的是没有额外CT图像的一个内窥镜导航算法,应用场景是鼻腔

    2024年02月11日
    浏览(37)
  • Functional Programming in Kotlin – Creating Functional

    作者:禅与计算机程序设计艺术 在Kotlin中创建函数式编程并发程序是一种面向对象的编程范式,其中的一些核心概念是: immutable数据结构, 函数作为第一等公民, 协程。本文将详细阐述如何使用Kotlin构建函数式并发程序,涵盖的内容包括异步编程、并发编程、Java内存模型与K

    2024年02月06日
    浏览(29)
  • 阅读笔记2:Characterization of Metabolic Patterns in Mouse Oocytes during Meiotic Maturation

    Characterization of metabolic patterns in mouse oocytes during meiotic maturation 作者:Ling Li, Shuai Zhu, Wenjie Shu, …, Xuejiang Guo, Minjian Chen, Qiang Wang 发表期刊:Molecular Cell 发表时间:November 5, 2020 摘要解读 研究背景 : 平衡及时的代谢对于产生高质量的卵子至关重要。然而,支持卵母细胞发展的代

    2024年02月21日
    浏览(38)
  • Abandoning the Bayer-Filter to See in the Dark 论文阅读笔记

    这是CVPR2022的一篇暗图增强的文章,TCL AI Lab与福州大学,韩国延世大学,安徽大学的合作论文 网络以黑暗环境下拍摄的color raw为输入,用一个de-bayer-filter module恢复无拜尔滤波器的raw data(文章认为拜尔滤波器使得光子数量被滤去许多,无拜尔滤波器的摄像机拍摄得到的raw d

    2024年02月16日
    浏览(37)
  • 【论文阅读笔记】Sam3d: Segment anything model in volumetric medical images[

    Bui N T, Hoang D H, Tran M T, et al. Sam3d: Segment anything model in volumetric medical images[J]. arXiv preprint arXiv:2309.03493, 2023.【开源】 本文提出的SAM3D模型是针对三维体积医学图像分割的一种新方法。其核心在于将“分割任何事物”(SAM)模型的预训练编码器与一个轻量级的3D解码器相结合。与

    2024年01月20日
    浏览(36)
  • K8s in Action 阅读笔记——【13】Securing cluster nodes and the network

    Pod中的容器通常在不同的Linux名称空间下运行,这使得它们的进程与其他容器或节点默认名称空间下运行的进程隔离开来。 例如,我们学习到每个Pod都拥有自己的IP和端口空间,因为它使用其自己的网络名称空间。同样,每个Pod也拥有自己的进程树,因为它有自己的PID名称空

    2024年02月11日
    浏览(32)
  • K8s in Action 阅读笔记——【14】Securing cluster nodes and the network

    迄今为止,创建了 Pod 而不考虑它们允许消耗多少 CPU 和内存。但是,正如将在本章中看到的那样,设置 Pod 预期消耗和允许消耗的最大数量是任何 Pod 定义的重要部分。设置这两组参数可以确保 Pod 只占用 Kubernetes 集群提供的资源中的份额,并且还影响 Pod 在集群中的调度方式

    2024年02月08日
    浏览(30)
  • [论文阅读笔记] TRACE: A Comprehensive Benchmark for Continual Learning In Large Language Models

    TRACE: A Comprehensive Benchmark for Continual Learning In Large Language Models arXiv2023 复旦大学 Benchmark、Continual Learing、LLMs 已经对齐过的大模型 (Aligned LLMs )能力很强,但持续学习能力缺乏关注; 目前CL的benchmark对于顶尖的LLMs来说过于简单,并且在指令微调存在model的potential exposure。(这里的

    2024年01月18日
    浏览(45)
  • 阅读笔记3:Metabolic signatures in human follicular fluid identify lysophosphatidylcholine as a predictor

    Metabolic signatures in human follicular fluid identify lysophosphatidylcholine as a predictor of follicular development 作者:Jihong Yang, Yangbai Li, Suying Li, Yan Zhang, Ruizhi Feng, Rui Huang, Minjian Chen Yun Qian 发表期刊:Communications Biology 发表时间:29 July 2022 这篇论文的主题是探究人类卵泡液(Follicular Fluid, FF)中

    2024年02月19日
    浏览(23)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包