IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> C++知识库 -> [翻译]《Programming - Principles and Practice Using C++ Second Edition》- Chapter 0 -> 正文阅读

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

书籍封面

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 think of. We aim to ask and answer questions that you need to consider when writing quality software for the use of others.
我们会提出初学者可能很难想出来的问题。我们意在让学生必须意识到要做出对他人有用的高质量软件,才能回答我们提出的问题。

Learning to ask the right (often hard) questions is an essential part of learning to think as a programmer. Asking only the easy and obvious questions would make you feel good, but it wouldn’t help make you a programmer.
学会去问正确的(往往也是困难)的问题是学会像程序员一样思考的本质。只问一些简单明显的问题可能会让学生觉得舒服,但无助于学生成为好程序员。


We try to respect your intelligence and to be considerate about your time.
我们会尽力去照顾你的智商并考虑你拥有多少时间。

In our presentation, we aim for professionalism rather than cuteness, and we’d rather understate a point than hype it.
我们的表达会做到专业而非戏言,对重点的讲解也追求通俗易懂而非拔高晦涩。

We try not to exaggerate the importance of a programming technique or a language feature, but please don’t underestimate a simple statement like “This is often useful.”
我们不会过分夸大一种编程方法和语言特性的重要性,但你也不要过分低估被评价为「这玩意儿很有用」的简单语句。

If we quietly emphasize that something is important, we mean that you’ll sooner or later waste days if you don’t master it
如果我们强调一些东西很重要,我们的意思是如果你不能掌握它,你将会卡住好几天。

Our use of humor is more limited than we would have preferred, but experience shows that people’s ideas of what is funny differ dramatically and that a failed attempt at humor can be confusing.
尽管我们想把书写得幽默,但我会控制抖机灵的次数,因为经验告诉我,如果玩笑开得好,学生印象会很深刻,但一旦拉了,学生会很困惑。


We do not pretend that our ideas or the tools offered are perfect.
我们不会撒谎我们传授的思想和方法是完美无误的。

No tool, library, language, or technique is “the solution” to all of the many challenges facing a programmer. At best, it can help you to develop and express your solution.
反之,没有任何一种工具,库,语言和技术可以完美适合解决程序员遇到的各种难题。它们只能帮助你改进和表达出你的解法。

We try hard to avoid “white lies”; that is, we refrain from oversimplified explanations that are clear and easy to understand, but not true in the context of real languages and real problems.
我们也避免撒善意的谎言;也就是说,我们不会对清楚明了的简单概念进行过度的二次解释,因为过于简化根本不适用于真实的语言和问题的复杂度。

On the other hand, this book is not a reference; for more precise and complete descriptions of C++, see Bjarne Stroustrup, The C++ Programming Language, Fourth Edition (Addison-Wesley, 2013), and the ISO C++ standard.
这本书并不是一本参考手册,如果你需要更精确和完整的C++描述,请看我的另一本书:Bjarne Stroustrup, The C++ Programming Language, Fourth Edition (Addison-Wesley, 2013) 和 ISO的C++标准

在这里插入图片描述

0.1.2 Drills, exercises, etc. 练习,编程题,其它

Programming is not just an intellectual activity, so writing programs is necessary to master programming skills. We provide two levels of programming practice:
编程并不只是智力活动,还需付出体力进行大量的编程练习,我们提供两个水平编程练习:

  • Drills 2 : A drill is a very simple exercise devised to develop practical, almost mechanical skills. A drill usually consists of a sequence of modifications of a single program. You should do every drill. A drill is not asking for deep understanding, cleverness, or initiative. We consider the drills part of the basic fabric of the book. If you haven’t done the drills, you have not “done” the book.
  • Drills:drill是为了开发实践,机械性的小练习。通常包含程序改错题。你应该把每道drill都做一遍。drill不需要深入理解,不需要调动太多智商。我们把drills看做本书的一种基本组成。如果你不做drill,那么相当于你没看过这本书。
  • Exercises: Some exercises are trivial and others are very hard, but most are intended to leave some scope for initiative and imagination. If you are serious, you’ll do quite a few exercises. At least do enough to know which are difficult for you. Then do a few more of those. That’s how you’ll learn the most. The exercises are meant to be manageable without exceptional cleverness, rather than to be tricky puzzles. However, we hope that we have provided exercises that are hard enough to challenge anybody and enough exercises to exhaust even the best student’s available time. We do not expect you to do them all, but feel free to try.
  • Exercises:一些exercise难度一般,一些则非常难,但是大多数都有铺垫并调动想像。如果你想认真对待学习,你可以做大部分练习题。至少知道哪些题对于你来说是难的,然后也尝试做一点儿难题。这样你才可以学到更多。这些练习被设计成不需要穷尽智商就可以解的难度,而不是一些嘎咕的偏题怪题。然而,我们希望通过练习让任何学生得到挑战,所以题量足以榨干最好学生的所有时间。我们不要求你把所有题都做完,但你要尽力去尝试。

In addition, we recommend that you (every student) take part in a small project (and more if time allows for it).
除了练习之外

(未完待续)


  1. 当理论与实际不符时,要以实际情况为准,不要按图索骥,颠倒虚实。 ??

  2. drill和exercise都有「练习」的意思,所以我们这里不对这两个词做翻译。 ??

  C++知识库 最新文章
【C++】友元、嵌套类、异常、RTTI、类型转换
通讯录的思路与实现(C语言)
C++PrimerPlus 第七章 函数-C++的编程模块(
Problem C: 算法9-9~9-12:平衡二叉树的基本
MSVC C++ UTF-8编程
C++进阶 多态原理
简单string类c++实现
我的年度总结
【C语言】以深厚地基筑伟岸高楼-基础篇(六
c语言常见错误合集
上一篇文章      下一篇文章      查看所有文章
加:2021-09-02 11:09:57  更:2021-09-02 11:12:21 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/23 20:03:33-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码