/CPP

My cs205 studying

Primary LanguageC++

Programming in C/C++ Efficiently

Course 'CS205 C/C++ Program Design' in 2021 Fall at Southern University of Science and Technology. The lecture videos can be found at https://www.bilibili.com/video/BV1Vf4y1P7pq

Why Should You Take This Course?

C and C++ have a big overlap in syntax. The standards of C and C++ are also very long, and still in evolution to accept new features. This course will not cover all aspects of C and C++. It is impossible. The course focuses on the most important and unique parts of C and C++. Pointers and memory management will be described and explained almost through all chapters. They make many beginners even experienced developers crazy for bugs difficult to find. But they are important for computing efficiently, and also are the unique advantages of C and C++. Some people hate them, and some love them. We can say pointers and memory management make C and C++ unique to most other advanced programming languages.

The course is designed for undergraduate students who have learnt Java or Python. If the students taking this course have some background knowledge of programming, such as knowing a little Java or Python, it will be helpful. If not, it is also not a problem.

Chapter 1: Getting Started

  1. The first example
  2. Different programming languages
  3. Compile and link
  4. Different errors
  5. Preprocessor and macros
  6. Simple input and output
  7. Command line arguments
  8. Exercises

Chapter 2: Data Types and Arithmetic Operators

  1. Integer numbers
  2. Different integer types
  3. Floating-point numbers
  4. Constant numbers and constant variables
  5. Arithmetic operators
  6. Special notes

Chapter 3: Branching and Looping Statements

  1. if statement
  2. ? : operator
  3. Conditional expressions
  4. while loop
  5. for loop
  6. goto statement
  7. switch statement

Chapter 4: Data Structures

  1. Arrays
  2. Strings
  3. Structures unions and enumerations
  4. typedef

Chapter 5: Memory and Pointer

  1. Pointers
  2. Pointers and arrays
  3. Allocate memory in C style
  4. Allocate memory in C++ style

Chapter 6: Basics of Functions

  1. Functions
  2. Function parameters
  3. References
  4. return statement
  5. inline function

Chapter 7: Advances in Functions

  1. Default arguments
  2. Function overloading
  3. Function templates
  4. Function pointers and references
  5. Recursive functions

Chapter 8: Speedup Your Program

  1. C and C++ with ARM
  2. Speedup your program
  3. An example with SIMD and OpenMP
  4. Avoid memory copy in OpenCV

Chapter 9: Basics of Classes

  1. Classes and objects
  2. Constructors and destructors
  3. this pointer
  4. const and static members

Chapter 10: Advances in Classes

  1. Operators in OpenCV
  2. Operator overloading
  3. Friend functions
  4. User defined type conversion
  5. Increment and decrement operators

Chapter 11: Dynamic Memory Management in Classes

  1. Some default operations
  2. An example with dynamic memory
  3. Solution1: Hard copy
  4. Solution2: Soft copy
  5. Smart pointers

Chapter 12: Class Inheritance

  1. Improve your source code
  2. Derived class
  3. Access control
  4. Virtual functions
  5. Inheritance and dynamic memory allocation
  6. Examples in opencv

Chapter 13: Class Templates and std Library

  1. Class template
  2. Template non-type parameters
  3. Class template specialization
  4. std classes

Chapter 14: Error Handling

  1. Standard output stream and standard error stream
  2. assert
  3. Exceptions
  4. More about exceptions
  5. nothrow

Chapter 15: Nested Classes and RTTI

  1. Friend classes
  2. Nested types
  3. RTTI and type cast operators

Reference

  1. Mr. Yitong Wang's repo for the course in Fall 2020. https://github.com/YeeTone/CS205-2020Fall
  2. Mr. Zheng Dong's repo for the course in Fall 2021. https://github.com/XDZhelheim/CS205_C_CPP_Lab
  3. Mr. Wenqian Yan's repo for the course in Fall 2022. https://github.com/YanWQ-monad/SUSTech_CS205_Projects