Sams Teach Yourself C++ in 21 Days (7th Edition) cover

Sams Teach Yourself C++ in 21 Days (7th Edition)

Rating 4.5
Word count
870 words
Chapters
34
ISBN
9787115296245

Tags

Summary

C++ in One Hour a Day, 7th Edition, is the Chinese translation of the seventh edition of Sams Teach Yourself C++ in One Hour a Day, translated by Yuan Guozhong and Yang Xiaoke. Structured around a one-hour-a-day pace, the book's 29 chapters break down the core knowledge of C++ and the new features of C++11 into compact units that can each be read in an hour. Every chapter includes sample programs, output results, and code analysis, and closes with a Q&A, quiz, and exercises, with answers collected in Appendix D for convenient self-assessment. The content starts from the very basics: the history of C++ and the compilation and execution process, the fundamental components of a program, variables and constants, arrays and strings, expressions and operators, flow control, functions, pointers and references. It then moves into object-oriented programming, covering classes and objects, inheritance, polymorphism, operator overloading, and type-conversion operators. Further chapters introduce macros and templates, the Standard Template Library (containers such as string, vector, list/forward_list, set, and map, along with function objects), lambda expressions, STL algorithms, adaptive containers such as stacks and queues, bit flags, smart pointers, and stream-based input/output and exception handling. The final chapter offers guidance on learning paths and directions for further study. The book assumes no prior C background and serves both as a textbook for university C++ courses and as an introductory self-study guide.

Editor's review

很多 C++ 入门书败在两点:一是厚得像砖头,二是只讲语法不讲用法。这本书恰好相反——458 页、29 章,每章控制在“一小时”的阅读量内,章节短、代码短、反馈快,很适合利用零散时间推进。 第7版最值得留意的升级是全面覆盖 C++11:lambda 表达式、智能指针、auto 与 constexpr、forward_list 等新内容都进了正文,而不是作为“补充阅读”塞在附录里。这意味着读者学完不会停留在 C++98 的旧习惯上,能直接写出符合现代风格的代码。 结构安排也相当克制:前 14 章打语言基础,第 15—25 章集中攻 STL,第 26—28 章讲智能指针、I/O 和异常,最后用一章收束学习路径。每章末尾的“问与答+测验+练习”是本书真正的价值点,建议动手做,而不是只读答案。 需要说明的是,本书偏重“会用”而非“用得好”,对模板元编程、移动语义细节、性能优化等着墨有限。把它当作第一本 C++ 书非常合适;若想深入语言机制,还需配合《C++ Primer》或《Effective C++》继续。

Who it's for

A good fit for

  • 没有任何编程基础、想系统自学 C++ 的初学者
  • 学过 C 语言,想转向面向对象与 STL 的读者
  • 需要一本可作教材的高校 C++ 课程师生
  • 想快速了解 C++11 新特性(lambda、智能指针等)的在职程序员

Not a good fit for

  • 已有多年 C++ 经验、想深入模板元编程与性能优化的资深开发者
  • 只想要速查手册、不愿做章末练习的读者
  • 期待覆盖 C++14/17/20 最新标准的读者,本书内容止于 C++11

Reading tips

  1. 按章节顺序每天读一到两章,先读完示例代码再自己重敲一遍,不要只浏览。
  2. 每章末尾的测验与练习务必动手做,做完再对附录 D,错题回到对应小节重读。
  3. 第15—25 章 STL 部分是全书重点,建议边读边用 vector、map、算法写一个小的练习项目。
  4. 读完本书后可接《C++ Primer》或《Effective C++》,补足语言细节与工程实践。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Chapter 1 Introduction
  2. Chapter 2 The Parts of a C++ Program
  3. Chapter 3 Using Variables and Constants
  4. Chapter 4 Managing Arrays and Strings
  5. Chapter 5 Using Expressions, Statements, and Operators
  6. Chapter 6 Controlling Program Flow
  7. Chapter 7 Organizing Code with Functions
  8. Chapter 8 Explaining Pointers and References
  9. Chapter 9 Classes and Objects
  10. Chapter 10 Implementing Inheritance
  11. Chapter 11 Polymorphism
  12. Chapter 12 Operator Types and Operator Overloading
  13. Chapter 13 Type-Conversion Operators
  14. Chapter 14 A Brief Introduction to Macros and Templates
  15. Chapter 15 Introduction to the Standard Template Library
  16. Chapter 16 The STL string Class
  17. Chapter 17 The STL Dynamic Array Class
  18. Chapter 18 STL list and forward_list
  19. Chapter 19 STL Set Classes
  20. Chapter 20 STL Map Classes
  21. Chapter 21 Understanding Function Objects
  22. Chapter 22 C++ Lambda Expressions
  23. Chapter 23 STL Algorithms
  24. Chapter 24 Adaptive Containers: Stacks and Queues
  25. Chapter 25 Using STL Bit Flags
  26. Chapter 26 Understanding Smart Pointers
  27. Chapter 27 Input and Output with Streams
  28. Chapter 28 Exception Handling
  29. Chapter 29 Moving On
  30. Appendix A Binary and Hexadecimal
  31. Appendix B C++ Keywords
  32. Appendix C Operator Precedence
  33. Appendix D Answers
  34. Appendix E ASCII Codes

FAQ

这本书需要先学 C 语言吗?
不需要。书中明确面向 C++ 初学者编写,不要求读者具备 C 语言背景,变量、流程控制、函数等基础内容都从头讲起,有 C 语言基础只是学起来更快一些。
第7版和其他版本有什么区别?
第7版对应英文原书《Sams Teach Yourself C++ in One Hour a Day》第7版,主要变化是全面纳入 C++11 标准,新增 lambda 表达式、智能指针、constexpr、forward_list 等内容,作者也由 Jesse Liberty、Bradley Jones 换为 Siddhartha Rao。
“21天学通”是真的 21 天能学会吗?
书名是营销化的编排思路,实际全书 29 章,按每天一小时、一天一章计算接近一个月。它提供的是循序渐进的学习路径,能否掌握取决于是否动手写代码和完成练习,不建议把它当作速成保证。
书里的代码能在什么环境编译?
第7版涉及 C++11 特性,需使用支持 C++11 的编译器,如 Visual Studio 2010 及以后版本、GCC 4.7 及以上、Clang 3.1 及以上。用更老的编译器会因不支持 lambda、auto 等特性而报错。
这本书的豆瓣评分是多少?
据豆瓣页面显示,该书评分约 9.0 分(评价人数较少,约数十人),评分主要反映入门读者的正面体验,参考时宜结合评价人数一并看待。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

Top rated in the same category