We may earn an affiliate commission when you visit our partners.
Course image
Jiaying Liu 刘家瑛, Ph.D. and 郭 炜

北京大学《C++程序设计》这门课将向你讲授C++程序设计有关的概念和语法,使你能够使用C++语言,以面向对象的方法编写可维护性、可扩充性好的,较大规模的程序。我们建议你在开始本课程之前已经熟悉了C语言和基本程设编写。这门课则将带你掌握C++语言中类、对象、运算符重载、继承、多态等面向对象的程序设计方法,以及模板、标准模板库STL等泛型程序设计的机制,体会和领悟面向对象程序设计方法和泛型程序设计方法的优势。

Enroll now

What's inside

Syllabus

快来加入我们吧!
在完成了计算导论和C程序设计两门课程之后,你是不是被编写程序中逻辑思维的过程与设计精秒的小程序解决实际生活中的问题所深深吸引?你是不是有时也会为大篇幅的程序设计中查错、复用等问题而纠结?快来加入专项课程的第三门课程《C++程序设计》中来吧,为你撑起“面向对象”的另一片天地!通过这门课程的学习,你将有能力驾驭大规模的程序开发,提升自身的编程素养,并为后续的算法、数据结构等课程的学习奠定坚实的基础!PS:我们这门课程一直处在不断地建设与优化当中,吸取了很多以往课程的经典视频,所以如果你看到视频中出现了不同课程的名字,也不要惊讶哦,因为你正在集百家所长:)
Read more
从C走进C++
C++是在C语言的基础上创建的一门功能更为强大的面向对象程序设计语言。在正式开始C++程序设计学习之初,我们首先回顾C语言中的高级内容,包括函数指针、命令行参数、位运算和动态内存分配,并在此基础上对C语言进行扩充,引入了引用、const关键字和常量、内联函数和重载函数、函数缺省参数等内容,为后续的C++程序设计的学习打下基础。面向对象的程序设计更接近于真实世界,它要分析待解决的问题中,有哪些类事物,每类事物都有哪些特点,不同的事物种类之间是什么关系,事物之间如何相互作用。本模块将初步介绍面向对象的程序设计的基本内容,尤其是“类”和“对象”这两个重要概念。PS:我们这门课程一直处在不断地建设与优化当中,吸取了很多以往课程的经典视频,所以如果你看到视频中出现了不同课程的名字,也不要惊讶哦,因为你正在集百家所长:)
类和对象
在对类和对象有了初步的了解后,大家已经知道类是C++中十分重要的概念,它是实现面向对象程序设计的基础。类是所有面向对象的语言的共同特征,所有面向对象的语言都提供了这种类型。本模块将进一步介绍类和对象的相关深入概念与内容,包括用于初始化的构造函数,以及复制构造函数,析构函数等。
运算符重载
如果不做特殊处理的话,C++的“+”“-”“*”“/”等运算符只能用于对基本类型的常量或变量进行运算,不能用于对象之间的运算。我们希望对象之间也能用这些运算符进行运算,例如,复数之间是可以进行四则运算的,两个复数对象相加如果直接用“+”运算符完成,那不是很直观和简洁吗?本模块将介绍利用C++提供的“运算符重载”机制,赋予运算符新的功能,就能解决对象之间运算的问题。
继承与派生
代码重用是提高软件开发效率的重要手段,因此C++对代码重用有很强的支持,继承与派生就是支持代码重用的机制之一。例如,要编写一个学生管理程序,必然要设计一个“学生”类,“学生”类会包含学生共有的姓名、学号等属性,但是中学生、大学生、研究生又有各自不同的属性和方法,如果为每种学生单独编写一个类会造成重复与浪费。本模块将介绍通过继承和派生机制,可以在基类的基础上派生出不同的类,从而达到代码重用的目的。
多态与虚函数
多态是指同一名字的事物可以完成不同的功能,例如有几个相似而不完全相同的对象,有时人们要求在向它们发出同一个消息时,它们的反应各不相同,分别执行不同的操作。在C++中,所谓多态性是指由继承而产生的相关的不同的类,其对象对同一消息会作出不同的响应。多态性是面向对象程序设计的一个重要特征,能有效增加程序的灵活性。
文件操作和模板
计算机中为了便于数据的管理和检索,引入了“文件”的概念。在程序中,要使用一个文件,先要打开,打开后才能读写,读写完后要关闭。本模块将介绍C++流类相应的成员函数来实现文件操作的功能。此外,你还将学习到如何通过编写模板进行泛型程序设计,所谓“泛型”就是算法只要实现一遍,就能适用于多种数据类型。也可以说,泛型程序设计就是大量编写模板、使用模板的程序设计。
标准模板库 STL-1
本模块将介绍C++的标准模板库(Standard Template Library,STL),这是泛型程序设计最成功的应用实例。STL是一些常用数据结构(如链表、可变长数组、排序二叉树)和算法(如排序、查找)的模板的集合。有了STL,你就不必编写大多的、常用的数据结构和算法。即便不想用面向对象的程序设计方法编程,学习STL也是大有裨益的。
标准模板库 STL-2
本模块将继续介绍C++的标准模板库(Standard Template Library,STL),这是泛型程序设计最成功的应用实例。STL是一些常用数据结构(如链表、可变长数组、排序二叉树)和算法(如排序、查找)的模板的集合。有了STL,你就不必编写大多的、常用的数据结构和算法。即便不想用面向对象的程序设计方法编程,学习STL也是大有裨益的。
期末考试
基础Wow~ 恭喜你已顺利完成了C++课程八个模块知识点的学习,在被魔兽世界各种虐心虐神之后,有没有对于C++有着一点高屋建瓴的别样体会啊?快来最后体验一下我们的期末测试吧(这是原汁原味的北京大学该课程试题,没有任何改动)!也希望与大家相聚在专项课程的下一门《算法设计》课程中,有了C和C++两种程序语言的基础,你需要进一步提升自身的算法设计技巧,让程序跑的通,还要跑的妙!
[选学] C++高级主题和C++11新特性
[选学] C++高级主题和C++11新特性: 本模块给大家介绍一些C++程序设计的进阶内容,以及最新C++11标准的部分新特性。该模块内容不属于本课程必须掌握的教学内容,但是通过了解和学习必将为你打开一扇C++学习的新门,继续探索程序设计的各种精妙与美好!
结束语
每一次的结束与分离,都是为了我们下一次更好的相遇。期待与你相会在《算法基础》课程!这次的视频我们来点儿不一样的吧 ^_____^

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
适合希望通过面向对象的形式掌握 C++ 编程的人
知识点和概念讲解详细,涵盖了 C++ 编程的基本方法
提供动手编程练习,帮助巩固对 C++ 语法的理解
课程内容较为基础,适合初学者入门 C++ 编程
涉及面向对象编程、模板和标准模板库等重要概念
由北京大学讲师授课,具有较高的学术权威性

Save this course

Save C++程序设计 to your list so you can find it easily later:
Save

Reviews summary

Great c++ course

This course offers a structured and comprehensive introduction to C++ programming, with a focus on object-oriented principles and advanced concepts like inheritance, polymorphism, and templates. Reviewers highly praised the course's detailed explanations, challenging coding assignments, and its ability to vermitteln a deep understanding of C++. However, some reviewers expressed concerns about the outdated compiler and lack of English subtitles.
Provides a solid foundation for C++
"A nice lesson for cpp beginners."
In-depth explanations and challenging assignments
"优秀的C++教程,讲的很细致"
"It is a great C++ course with deep C++ knowledge and challenging coding assignments."
Insufficient error feedback and testing data
"这个课程的编程作业给的报错信息太少了,当程序复杂的时候,debug十分困难"
"The course was great for providing a basic understanding of C++. However, I found the assignments to be excessively difficult."
Course materials only available in Chinese
"Unfortunately, only Chinese language is provided."
Built-in compiler lacks support for newer C++ features
"The only bad thing of this course is the built-in c++ compiler ... it seems that the online cpp compiler is in c++98 version"
"some built-in functions in c++11 or later version were not accepted in c++98 so there will be some compile errors."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in C++程序设计 with these activities:
阅读《C++ Primer》
深入了解C++编程语言的语法、特性和最佳实践。
View C++ Primer on Amazon
Show steps
  • 阅读第1部分:C++语法基础
  • 阅读第2部分:C++标准库
  • 阅读第3部分:高级C++特性
  • 完成书中的练习题和项目
编译练习题
复习C++程序设计的语法和基本概念,为后续的课程学习打下基础。
Browse courses on C++
Show steps
  • 复习C++中的函数和指针
  • 练习使用C++中的引用和关键字“const”
  • 尝试使用内联函数和重载函数
  • 利用C++的函数缺省参数
小组讨论
与同学讨论课程内容,分享见解并解决问题。
Browse courses on C++
Show steps
  • 选择一个讨论主题,例如面向对象程序设计中的继承
  • 组织小组会议,并确保每个人都做好准备
  • 在会议中讨论主题,分享想法和观点
  • 总结讨论并记录关键点
Four other activities
Expand to see all activities and additional details
Show all seven activities
编写博客文章
撰写一篇博客文章,总结课程中学到的关键概念。
Browse courses on C++
Show steps
  • 选择一个课程中的主题,例如STL的容器
  • 研究主题,并收集相关信息
  • 撰写博客文章,解释概念并提供示例
  • 发布文章并与他人分享
参加C++编程研讨会
参加研讨会,向经验丰富的C++开发人员学习。
Browse courses on C++
Show steps
  • 查找并注册一个相关的研讨会
  • 积极参与研讨会,并向讲师和同学提问
  • 应用研讨会中学到的知识到自己的C++项目中
参加C++编程竞赛
参加竞赛,在紧张的环境中测试自己的C++技能。
Browse courses on C++
Show steps
  • 查找并注册一个相关的竞赛
  • 练习解决算法问题和编写高效的C++代码
  • 在竞赛中提交自己的解决方案
  • 分析竞赛结果,并学习如何改进自己的代码
参与C++开源项目
为C++开源项目做出贡献,提升自己的编程能力和协作技能。
Browse courses on C++
Show steps
  • 查找一个感兴趣的C++开源项目
  • 阅读项目的文档和代码库
  • 提出问题或建议,并提交代码拉取请求
  • 与项目维护者合作,完善自己的贡献

Career center

Learners who complete C++程序设计 will develop knowledge and skills that may be useful to these careers:
Computer Programmer
Computer Programmers are responsible for writing and maintaining computer programs. This course in C++ programming will help build a foundation of essential programming concepts and syntax that are used in computer programming. Students will learn about topics such as object-oriented programming, inheritance, generics, templates, and more. These are all key concepts that are used in modern computer programming.
Game Developer
Game Developers are responsible for designing and developing video games. This course in C++ programming will help build a foundation of essential programming concepts and syntax that are used in game development. Students will learn about topics such as object-oriented programming, inheritance, generics, templates, and more. These are all key concepts that are used in modern game development.
Software Engineer
Software Engineers are responsible for designing, developing and maintaining software applications. This course in C++ programming will help build a foundation of essential programming concepts and syntax that are used in many different areas of software engineering. Students will learn about topics such as object-oriented programming, inheritance, generics, templates, and more. These are all key concepts that are used in modern software development.
Database Administrator
Database Administrators are responsible for managing and maintaining databases. This course in C++ programming may be useful for Database Administrators because it will help them to understand the underlying principles of how databases work. This can be helpful when managing and maintaining complex databases.
Web Developer
Web Developers are responsible for designing and developing websites. This course in C++ programming may be useful for Web Developers because it will help them to understand the underlying principles of how websites work. This can be helpful when designing and developing complex websites.
Network Administrator
Network Administrators are responsible for managing and maintaining computer networks. This course in C++ programming may be useful for Network Administrators because it will help them to understand the underlying principles of how computer networks work. This can be helpful when managing and maintaining complex computer networks.
Information Security Analyst
Information Security Analysts are responsible for protecting computer systems and networks from unauthorized access. This course in C++ programming may be useful for Information Security Analysts because it will help them to understand the underlying principles of how computer systems work. This can be helpful when protecting computer systems and networks from unauthorized access.
Technical Writer
Technical Writers are responsible for writing technical documentation. This course in C++ programming may be useful for Technical Writers because it will help them to understand the technical concepts that are needed for this role.
Systems Analyst
Systems Analysts are responsible for analyzing and designing computer systems. This course in C++ programming may be useful for Systems Analysts because it will help them to understand the underlying principles of how software works. This can be helpful when designing and analyzing complex systems.
Mobile Developer
Mobile Developers are responsible for designing and developing mobile applications. This course in C++ programming may be useful for Mobile Developers because it will help them to understand the underlying principles of how mobile applications work. This can be helpful when designing and developing complex mobile applications.
Software Tester
Software Testers are responsible for testing and validating software applications. This course in C++ programming may be useful for Software Testers because it will help them to understand the underlying principles of how software works. This can be helpful when testing and validating complex software applications.
Project Manager
Project Managers are responsible for planning, executing, and closing projects. This course in C++ programming may be useful for Project Managers because it will help them to develop the technical skills that are needed for this role.
Computer Systems Analyst
Computer Systems Analysts are responsible for analyzing and designing computer systems. This course in C++ programming may be useful for Computer Systems Analysts because it will help them to understand the underlying principles of how computer systems work. This can be helpful when analyzing and designing complex computer systems.
Data Scientist
Data Scientists are responsible for collecting, analyzing, and interpreting data. This course in C++ programming may be useful for Data Scientists because it will help them to understand how to handle and process large datasets. This can be helpful when working with complex data sets.
Business Analyst
Business Analysts are responsible for analyzing and improving business processes. This course in C++ programming may be useful for Business Analysts because it will help them to develop the analytical and problem-solving skills that are needed for this role.

Reading list

We've selected nine books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in C++程序设计.
Helps to grasp the fundamentals and cores concepts of C++ and OOP, providing a solid foundation for further studies.
本书帮助理解C++和OOP的基本原理和核心概念,为进一步的学习奠定了坚实的基础。
Is written by the creator of C++. It offers an in-depth look at the language's design and implementation.
这本书提供了C++标准库的全面概述。

Share

Help others find this course page by sharing it with your friends and followers:
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser