[翻译]《Programming - Principles and Practice Using C++, Second Edition》- Chapter 0

本书旨在引导读者逐步掌握编程基础,采用C++语言,分为四个部分,涵盖编程基本概念、输入输出、数据与算法及编程视野拓展。书中强调实践与概念理解,提倡直接与读者交流的教学方式,注重培养读者的创造力和问题解决能力,同时关注编程的可移植性和编程语言的选取。
摘要由CSDN通过智能技术生成

书籍封面

Notes to the Readers 写给读者

When the terrian disagrees with the map 当实际地形与地图标定不符时
trust the terrian. 相信地形 1
——Swiss army proverb 瑞士军队格言
在这里插入图片描述

This chapter is a grab bag of information; it aims to give you an idea of what to expect from the rest of the book.
这一章是个信息大杂烩,是为了让你了解本书的全貌。

Please skim through it and read what you find interesting.
你可以快速略读并找到你感兴趣的地方仔细阅读。

A teacher will find most parts immediately useful.
老师可以快速找到重点内容。

If you are reading this book without the benefit of a good teacher, please don’t try to read and understand everything in this chapter; just look at “The structure of this book” and the first part of the “A philosophy of teaching and learning” sections.
如果你没有老师的辅助,那么不要试图去读和理解这章的全部内容;只需要看「本书结构」和「教学和学习的哲学的第一部分」。

You may want to return and reread this chapter once you feel comfortable writing and executing small programs.
等到你能轻松地编写并执行一些小程序之后可以再回来重读本章。


0.1 The structure of this book 本书结构

This book consists of four parts and a collection of appendices:
本书分成4个部分和一系列附录:

  • Part I, “The Basics,” presents the fundamental concepts and techniques of programming together with the C++ language and library facilities needed to get started writing code. This includes the type system, arithmetic operations, control structures, error handling, and the design, implementation, and use of functions and user-defined types.
  • 第一部分,「基础」, 介绍了编程的基本概念和方法和编程所需的C++语言和库的特性。这部分内容包括类型系统,算术运算,控制结构,错误处理和设计,实现以及函数的使用和用户自定义类型。
  • Part II, “Input and Output,” describes how to get numeric and text data from the keyboard and from files, and how to produce corresponding output to the screen and to files. Then, it shows how to present numeric data, text, and geometric shapes as graphical output, and how to get input into a program from a graphical user interface (GUI).
  • 第二部分,「输入和输出」, 介绍了如何从键盘和文件获取输入,如何向屏幕和文件进行输出。怎样表示数值类型的数据,文本和几何图形,如何通过GUI获取输入。
  • Part III, “Data and Algorithms,” focuses on the C++ standard library’s containers and algorithms framework (the STL, standard template library). It shows how containers (such as vector, list, and map) are implemented (using pointers, arrays, dynamic memory, exceptions, and templates) and used. It also demonstrates* the design and use of standard library algorithms (such as sort, find, and inner_product).
  • 第三部分,「数据和算法」,介绍C++标准库容器和算法框架(标准库,标准模板库)。展示容器(例如vectorlistmap)是怎样通过各种方式(指针,数组,动态内存,exceptions和模板)实现的。还阐明了标准库算法的设计与使用方法(比如sortfindinner_product
  • Part IV, “Broadening the View,” offers a perspective on programming through a discussion of ideals and history, through examples (such as matrix computation, text manipulation, testing, and embedded systems programming), and through a brief description of the C language.
  • 第四部分,「拓展内容」, 从编程思想和历史这个不同的角度来介绍编程,通过举例(矩阵计算,文本处理,测试,嵌入式编程),并简要地介绍C语言。
  • Appendices provide useful information that doesn’t fit into a tutorial presentation, such as surveys of C++ language and standard library facilities, and descriptions of how to get started with an integrated development environment (IDE) and a graphical user interface (GUI) library.
  • 附录中包含了一些入门课程不涵盖的内容,比如C++语言和标准库,以及如何在IDE中开始编程和GUI库介绍。

Unfortunately, the world of programming doesn’t really fall into four cleanly separated parts
然而,真实的编程并不是能清晰地分出几个独立的部分的。

Therefore, the “parts” of this book provide only a coarse classification of topics.
所以本书只是提供一个粗略的分类。

We consider it a useful classification (obviously, or we wouldn’t have used it), but reality has a way of escaping neat classifications.
我们想要好好分类,但很显然,复杂的现实情况总会有一种方式不符合分类。

For example, we need to use input operations far sooner than we can give a thorough explanation of C++ standard I/O streams (input/output streams).
比如,我们需要在详细介绍C++的I/O流之前就要用到一些输入操作。

Where the set of topics needed to present an idea conflicts with the overall classification, we explain the minimum needed for a good presentation, rather than just referring to the complete explanation elsewhere.
当有类似这种需求与严格遵守分类相互矛盾的情况出现时,我们会先满足最小的使用需求而介绍一点点儿,而非等到后面再给出完整的解释。

Rigid classifications work much better for manuals than for tutorials.
粗略的分类比起手册式的按部就班,更适合作为教程。


The order of topics is determined by programming techniques, rather than programming language features; see §0.2. For a presentation organized around language features, see Appendix A.
章节内容安排是基于编程方法,而非语言特性(0.2节);如果想看与特性,请看附录A。


To ease review and to help you if you miss a key point during a first reading where you have yet to discover which kind of information is crucial, we place three kinds of “alert markers” in the margin:

  • Blue: concepts and techniques (this paragraph is an example of that)
  • Green: advice
  • Red: warning

为了当你忘记一个重点可以方便回来查询,我会在页边使用三种「警告标识」

  • 蓝色:概念和方法(这一段就是)
  • 绿色:建议
  • 红色:警告

0.0.1 General Approach 一般方法

In this book, we address* you directly. That is simpler and clearer than the conventional “professional” indirect form of address, as found in most scientific papers.
在本书中,我们会直接给你讲解内容,这样会比传统的,「专业」的,间接的,常见于学术论文中的讲解方式更加简洁明了。

By “you” we mean “you, the reader,” and by “we” we refer either to “ourselves, the author and teachers,” or to you and us working together through a problem, as we might have done had we been in the same room.
我说的「给你讲解」的「你」是指「正在读书的你」,而「我们」,要么是指「作为作者的我和老师」,要么是指「共同解决问题的你我」。


This book is designed to be read chapter by chapter from the beginning to the end.
这本书被设计成从头到尾一章一章地读。

Often, you’ll want to go back to look at something a second or a third time.
有时候,你可能会前后翻翻去回看一些内容。

In fact, that’s the only sensible approach, as you’ll always dash past some details that you don’t yet see the point in. In such cases, you’ll eventually go back again.
事实上,这才符合现实情况,你经常会读得很快,错过一些细节。这时你总要往回翻书。

However, despite the index and the cross-references, this is not a book that you can open to any page and start reading with any expectation of success.
但除了索引和交叉引用那几页,这并不是那种你随便翻到哪页都可以开始的书。

Each section and each chapter assume understanding of what came before.
每个部分,每一章节都是和之前内容环环相扣的。


Each chapter is a reasonably self-contained unit, meant to be read in “one sitting” (logically, if not always feasible on a student’s tight schedule). That’s one major criterion for separating the text into chapters.
每一章节在逻辑上都是一个完善的单元,应该「坐下来一口气读完」(当然了,如果日程安排比较紧张,做到这点可能比较难)。这是把正文分成章节的一种标准。

Other criteria include that a chapter is a suitable unit for drills and exercises and that each chapter presents some specific concept, idea, or technique.
另一种标准则是每个章节介绍特定的概念,思想和方法,配合练习题组成一个供学生深入研究的单元。

This plurality of criteria has left a few chapters uncomfortably long, so please don’t take “in one sitting” too literally.
这种标准会导致几个章节内容过于繁多,所以不要「一口气读完」。

In particular, once you have thought about the review questions, done the drill, and worked on a few exercises, you’ll often find that you have to go back to reread a few sections and that several days have gone by.
还有一种情况,当你做到复习题,思考题和编程练习时,你总会发现要回顾一下几天之前读到的上一个部分的内容。

We have clustered the chapters into “parts” focused on a major topic, such as input/output. These parts make good units of review.
对于这种情况,我们把同一类的各个章节放在一起组成一个主题,比如输入/输出,这样方便你做复习。


Common praise for a textbook is “It answered all my questions just as I thought of them!” That’s an ideal for minor technical questions, and early readers have observed the phenomenon with this book. However, that cannot be the whole ideal.
人们总是会夸一本书「啊对对对!我就是这么想的,我想得和答案一样」。这对次要的技术问题是一个理想的状态,初学者在读这本书或多或少都有此现象。但这并不是完全理想的。

We raise questions that a novice would probably not t

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
《计算机图形学:原理与实践》第21章-动画 动画在计算机图形学中起着重要的作用,它可以通过计算机生成逼真的运动图像来模拟现实世界中的动态效果。第21章详细介绍了动画的原理和实践。 动画的目标是通过序列帧的播放来创造出连续的运动感。本章介绍了两种常见的动画制作方法:关键帧动画和插值动画。 关键帧动画是通过在时间轴上选择关键帧来定义动画的开始和结束状态,然后计算机会自动填充中间帧。这种方法可以减少制作动画的工作量,但帧与帧之间的过渡可能不够平滑。 插值动画则通过在关键帧之间插入中间帧来创建流畅的动画效果。其中,线性插值是最简单的方法,通过计算两个关键帧之间的过渡来生成中间帧。其他的插值方法还包括贝塞尔曲线插值和样条插值等,它们能够更好地保持物体的形态和运动特性。 此外,本章还介绍了动画中的常见技术,如运动模糊和骨骼动画。运动模糊通过在连续帧之间模糊对象来模拟物体的运动轨迹,使动画更加真实。骨骼动画则是通过在物体上添加骨骼和关节来模拟物体的形变和动作,从而实现更加灵活和逼真的动画效果。 此外,本章还介绍了动画中使用的额外技术,如动画蒙皮和递归动画。动画蒙皮是将物体的外表表面贴上一个虚拟的模型,使其能够更好地跟随物体的运动。递归动画则是通过将一个物体分解成多个部分,然后对每个部分进行独立的动画处理,最终合成整个物体的动画。 总而言之,《计算机图形学:原理与实践》第21章详细介绍了动画的原理和实践,包括关键帧动画、插值动画、运动模糊、骨骼动画、动画蒙皮和递归动画等技术。通过学习本章内容,读者可以更好地理解和应用计算机图形学中的动画技术。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值