1
课程详述
COURSE SPECIFICATION
以下课程信息可能根据实际授课需要或在课程检讨之后产生变动。如对课程有任何疑问,请联
系授课教师。
The course information as follows may be subject to change, either during the session because of unforeseen
circumstances, or following review of the course at the end of the session. Queries about the course should be
directed to the course instructor.
1.
课程名称 Course Title
C/C++程序设计 C/C++ Programming Design
2.
授课院系
Originating Department
计算机科学与工程系 Department of Computer Science and Technology
3.
课程编号
Course Code
CS205
4.
课程学分 Credit Value
3
5.
课程类别
Course Type
专业选修课 Major Elective Courses
6.
授课学期
Semester
秋季 Fall
春季 Spring
7.
授课语言
Teaching Language
英文 English
8.
他授课教师)
Instructor(s), Affiliation&
Contact
For team teaching, please list
all instructors
郑锋,助理教授,计算机科学与工程系,zhengf@sustech.edu.cn
Feng Zheng, Assistant Professor, Department of Computer Science and Engineering,
zhengf@sustech.edu.cn
ROSSI, Luca,助理教授,计算机科学与工程系,rossil@sustech.edu.cn
ROSSI, Luca, Assistant Professor, Department of Computer Science and Engineering,
rossil@sustech.edu.cn
9.
/
方式
Tutor/TA(s), Contact
10.
选课人数限额(不填)
Maximum Enrolment
Optional
授课方式
Delivery Method
习题/辅导/讨论
Tutorials
实验/实习
Lab/Practical
其它(请具体注明)
OtherPlease specify
总学时
Total
11.
学时数
Credit Hours
32
64
2
12.
先修课程、其它学习要求
Pre-requisites or Other
Academic Requirements
13.
后续课程、其它学习规划
Courses for which this course
is a pre-requisite
CS203 数据结构与算法分析 Data Structures and Algorithm Analysis
CS208 算法设计与分析 Algorithm Design and Analysis
14.
其它要求修读本课程的学系
Cross-listing Dept.
教学大纲及教学日历 SYLLABUS
15.
教学目标 Course Objectives
C/C++是计算机科学与技术专业一门专业基础课程。其 C 是一种面向问题的通用程序设计语言,具有语言简洁、类型丰
富、结构完整、表达力强、直接操作内存单元、适用于块化结构等特点。C 语言既具有高级言的优点,又具有低级
言的许多特点。其 C++是面对对象开发方法,从 C 语言扩展而来。吸收了软件工程领域有益的概念和有效方法,它把
据和对数据的操作封装起来,集抽象性、封装性、继承性与多态性于一体,可以帮助人们开发出模块化、数据抽象程度高
的、信息隐蔽好的、可复用、易修改、易扩充等特性的程序。
该课程包括两个部分,第一部分为 C++中一般性设计原理,是 C 的部分;第二部分为面向对象部分。通过该课程的学习
学生可以为数据结构,算法设计与分析等课程打下坚实的基础。
C/C++ is a professional foundation course in computer science and technology. C is a general-purpose programming
language oriented to problems. It has the characteristics of simple language, rich types, complete structure, strong
expressiveness, direct operation of memory units, and application for modular structure. The C language has both the
advantages of a high-level language and many features of a low-level language. While, C++ is an object-oriented
development method that extends from the C language. It absorbs the useful concepts and effective methods in the field
of software engineering. It encapsulates data and operations on data, and integrates abstraction, encapsulation,
inheritance and polymorphism to help people develop programs with high modularity, high level of data abstraction,
information concealed, reusable, easy to modify, and easy to expand.
The course consists of two parts, the first part is the general design principle in C++, which is part of C; the second part is
the object-oriented part. Through this course, students can build a solid foundation for the courses of data structure, and
algorithm design and analysis.
16.
预达学习成果 Learning Outcomes
完成该课程,学生能够做到:
能够解释 C/C++程序语言的工作原理
能够阅读 C/C++程序,能够找出其中错误并修正错误
能够分析实际问题,构建 C/C++程序解决该问题
具有专业化的编程态度与习惯
面对实际问题时,具有编程思维
Upon completion of this course, students should be able to:
Explain how an existing C or C++ program works
Discover errors in a C or C++ program and describe how to fix them
Analyze a problem and construct a C or C++ program that solves it
Professional programming attitude and habits
Programming thinking
3
17.
课程内容及教学日历 (如授课语言以英文为主,则课程内容介绍可以用英文;如团队教学或模块教学,教学日历须注明
主讲人)
Course Contents (in Parts/Chapters/Sections/Weeks. Please notify name of instructor for course section(s), if
this is a team teaching or module course.)
第一周:导论
o 课程介绍
o C/C++背景介绍
o C/C++基本概念
[实验课] 介绍实验开发平台、编译工具并且指导学生成功安装各种工具。
第二周:处理数据
o 简单变量和 const
o 浮点数
o C++算术运算符
[实验课]
o 作业内容:实现一个从用户终端获取两个城市的名字以及经纬度的程序,这个程序可以求两个城市之间的距离,
并将距离输出到终端中。
o 考察目标:考察学生对 C/C++的基本语法了解程度,学生应当在本次作业中了解到 Java C/C++之间的区别。
第三周:复合类型
o 数组
o 字符串和 string
o 结构体
o 指针类型
[实验课] 如上,部分同学在第四周才能确认选课,所以第一次作业持续到第四周。
第四周:循环与关系表达式
o for 循环
o while 循环
o 循环的应用
[实验课] 如上。
第五周:分支语句与逻辑运算符
o if 语句
o 逻辑运算符与特殊运算符?
o switch 语句
[实验课]
o 作业内容:实现一个微型交互式终端。
o 考察目标:考察学生对 C/C++字符串的特性的了解程度,学生应当熟练掌握 C/C++字符串的操作。
第六周:函数
4
o 函数与数组
o 函数与结构
o 函数与字符串
o 函数与指针
[实验课] 如上。
第七周:函数探幽
o C++内联函数
o 引用变量
o 函数重载
o 函数模板
[实验课]
o 作业内容:给定一个存储了城市数据的文件(精度,维度,城市名),用户输入两个城市的名称,程序应当返回
两个城市之间的距离。
o 考察目标:考察学生对 C/C++文件 IO 了解程度。
第八周:内存类型与名称空间
o 单独编译
o 存储持续性、作用域和链接性
o 名称空间
[实验课] 如上。
第九周:对象和类
o 过程性编程与面向对象编程比较
o 抽象和类
o 类的构造和析构函数
o this 指针
o 类作用域
[实验课]
o 作业内容:给定包含 UTF-8 字符的文件,寻找文件中最高频率的字符所属的 UTF-8 字符子集。
o 考察目标:考察学生对字符编码机制和 C/C++文件 IO 了解程度。
第十周:使用类
o 运算重载符与示例
o 友元
o 重载运算符:作为成员函数还是非成员函数
o 类的自动转换和强制类型转换
[实验课] 如上。
第十一周:类和动态内存分配
5
o 动态内存和类
o 改进后的 string
o 在构造函数中使用 new 时应该注意事项
o 有关返回对象声明
o 使用指向对象的指针
[实验课]
o 作业内容:实现一个支持 UTF-8 字符的字符串类。
o 考察目标:考察学生对 C++面向对象编程的掌握程度。
第十二周:类继承
o 一个简单的基类
o 继承:is-a 关系
o 多态共有继承
o 静态联编和动态联编
o 访问控制:protected
o 继承和动态内存分配
[实验课] 如上。
第十三周:C++中的代码重用
o 包括对象成员的类
o 私有继承
o 多重继承
o 类模板
[实验课]
o 作业内容:对作业 5 中支持 UTF-8 字符的字符串类进行扩展,使其支持 C++原生的运算符。
o 考察目标:考察学生对 C++运算符重载机制的掌握程度。
第十四周:友元和异常
o 友元
o 嵌套类
o 异常
[实验课] 如上。
第十五周:string 类和标准模板库
o string
o 智能指针模板类
o 标准模板库
o 泛型编程
o 函数对象
6
[实验课]
o 作业内容:实现一个 3 维立方体类,该类拥有多个类成员函数并支持多个运算符。
o 考察目标:考察学生对 C++类和对象,运算符重载机制的掌握程度。
第十六周:总结和复习
[实验课] 复习、答疑。
Weak 1: Introduction
o Class introduction
o C/C++ background
o C/C++ basic concepts
[Lab 1]: Introduce IDE and compiler tools and help student successfully install these platforms and tools
Weak 2: Dealing with Data
o Simple variables and constants
o Floating point number
o C ++ arithmetic operator
[Lab 2]:
o ContentImplement a program which must prompt the user for the name of a first city, then its latitude and
longitude, then for the name of a second city with its latitude and longitude, then compute the flying distance between the
two and display the distance.
o Purpose Students will learn the basic concepts of C/C++. And students can learn the differences between
Java and C/C++.
Week 3: Compound Types
o Array
o String and string class
o Structure
o Pointer type
[Lab 2]:
The same with the above. Due to some students would confirm this course after the fourth week, the first lab assignment
will takes 3 weeks.
Week 4: Loops and Relational Expressions
o for loops
o while loops
o loop applications
[Lab 2]: The same with above.
Week 5: Branch Statements and Logical Operators
o if statement
o Logical operators and special operator: ?
o switch statement
7
[Lab 3]:
o Content: Implement a mini terminal
o Purpose: Students will learn the string and string operations in C/C++.
Week 6: Function
o Functions and arrays
o Function and structures
o Function and strings
o Function and pointers
[Lab 3]: The same with above.
Week 7: Adventures in Function
o C++ inline function
o Reference variable
o Function overloading
o Function template
[Lab 4]:
o Content: Given a file which records the information of cities (longitude, latitude and city name). Implement a
program which should load the file and return the distance if user enters two cities' names.
o Purpose: Students should master the knowledge of file I/O in C++.
Week 8: Memory Modules and Namespace
o Compiled separately
o Storage duration, scope and linkage
o Namespace
[Lab 4]: The same with above
Week 9: Objects and Classes
o Comparison between procedural programming and object-oriented programming
o Abstraction and class
o Class constructors and destructors
o The this pointer
o Class scope
[Lab 5]:
o Content: Given a file which includes UTF-8 characters, implement a program which can find the subset of the
highest frequent character in a file with UTF-8 characters.
o Purpose: Students should master the knowledge of string, encoding and file I/O in C++.
Week 10: Working with Classes
o Operator overloading and examples
o Introducing friend
o Overloaded operator: as a member function or a non-member function
o Automatic conversion and type cast for class
8
[Lab 5]: The same with above
Week 11: Class and Dynamic Memory Allocation
o Dynamic memory and class
o The improved string class
o Things to remember when using new
o Observations about returning objects
o Using pointers to objects
[Lab 6]:
o Content: Implement a string class which supports UTF-8 characters.
o Purpose: Students will learn the object-oriented programming in C++.
Week 12: Class Inheritance
o A simple base class
o Inheritance: an is-a relationship
o Polymorphic public inheritance
o Static and dynamic binding
o Access control: protection
o Inheritance and dynamic memory allocation
[Lab 6]: The same with above.
Week 13: Reusing Code in C++
o Classes with object members
o Private inheritance
o Multiple inheritance
o Class templates
[Lab 7]:
o Content: Extends the string class in assignment so it can support the native operators in C++
o Purpose: Students will should master the operator overloading in C++.
Week 14: Friends and Exceptions
o Friend
o Nested class
o Exceptions
[Lab 7]: The same with above.
Week 15: String Classes and Standard Template Library
o String class
o Smart pointer template class
o Standard template library
o Generic programming
o Function objects
9
[Lab 8]:
o Content: Implement a 3D box class which includes several member functions and supports native operators in
C++.
o Purpose: Students should master object-oriented programming and the operator overloading in C++.
Week 16: Summary and Review
[Lab 8]:
o The same with above
o Review and answer questions
18.
教材及其它参考资料 Textbook and Supplementary Readings
C++ Primer Plus
Sixth Edition
ISBN-13: 978-0-321-77640-2
Stephen Prata
课程评估 ASSESSMENT
19.
评估形式
Type of
Assessment
评估时间
Time
占考试总成绩百分比
% of final
score
违纪处罚
Penalty
备注
Notes
出勤 Attendance
课堂表现
Class
Performance
小测验
Quiz
10%
课程项目 Projects
40%
平时作业
Assignments
期中考试
Mid-Term Test
20%
期末考试
Final Exam
30%
期末报告
Final
Presentation
10
其它(可根据需
改写以上评估方
式)
Others (The
above may be
modified as
necessary)
20.
记分方式 GRADING SYSTEM
A. 十三级等级制 Letter Grading
B. 二级记分制(通/不通过) Pass/Fail Grading
课程审批 REVIEW AND APPROVAL
21.
本课程设置已经过以下责任人/员会审议通过
This Course has been approved by the following person or committee of authority