START HERE
Getting Started with C++
🌱
C++ is a powerful and widely used programming language that combines high-level abstraction with precise control over data and memory. This course introduces the core ideas of C++ through clear explanations, worked examples, and regular programming practice.
🧭
After an introduction to C++, we study data types, variables, input and output, and arithmetic. Week 3 introduces arrays, strings, and structures; Week 4 brings them together in a guided lab. Week 5 introduces pointers and the free store. We then study loops, branching statements, functions, objects and classes, and class inheritance, with a lab for each of these five topics. References and object initialization are introduced where they are needed. The final week is for review.
🧪
Lectures and labs focus on one core idea at a time. Students complete starter code, run simple tests, and explain their changes. Student information examples connect the object-oriented labs.
9 THEORY WEEKS · 6 LAB WEEKS · 1 REVIEW WEEK
Course Schedule
Weekly Learning Notes
Use these notes to prepare for each theory week and its class check. The six lab assignments remain short, guided exercises.
Week 1 — Getting Started with C++
- Create, compile, and run a program. Read #include <iostream>, main(), std::cout, return, braces, and semicolons. Use std:: to identify names from the standard library.
- Class check: change the message in Hello, World! and fix a missing semicolon. Learn to read the compiler's first error message.
Week 2 — Dealing with Data
- Declare and initialize int, double, char, and bool variables. Distinguish initialization from assignment; introduce const and simple type conversions.
- Use std::cin and std::cout, +, -, *, /, and %. Explain integer division, floating-point division, operator precedence, and compound assignment such as +=.
- Class check: read two integers and print their sum. Compare 5 / 2 with 5 / 2.0. Predict 5 % 2. Use valid numeric input throughout these first exercises.
Week 3 — Compound Types
- Initialize arrays and use indexes starting at 0 within valid bounds. Store and read text with std::string and std::getline.
- Group related values in a structure and access its members with the dot operator. Compare built-in arrays with std::array and std::vector.
- Class check: store a student's name and two scores, then print the name and average. Explain which array indexes are valid.
Week 5 — Pointers and the Free Store
- Explain addresses and pointer variables. Declare and initialize a pointer with &, read or change its pointed-to value with *, and recognize nullptr. Never dereference a null, uninitialized, or dangling pointer.
- Relate array elements to their addresses. Read the first two elements through a pointer and explain p + 1 within the same array. Distinguish a pointer variable from an array.
- Introduce new and delete with a small example. Match new[] with delete[] for dynamic arrays, and explain that released storage must not be accessed. Detailed manual memory management is beyond this introductory lesson.
- Class check: initialize int value = 10 and int* p = &value; predict value after *p = 20. Explain what p and *p represent.
Week 6 — Loops and Relational Expressions
- Trace for and while loops using initialization, a test condition, and an update. Use relational operators and ++; recognize the do while loop and its first execution before the test.
- Review array initialization, indexes starting at 0, and valid bounds from Compound Types. Use a short for loop to read the elements of a three-integer array.
- Class check: trace the sum from 1 to 3 and explain why a loop for n = 0 does not run. Identify the valid indexes of int scores[3].
Week 8 — Branching Statements and Logical Operators
- Use if, if else, and else if with relational operators and the logical operators &&, ||, and !. Distinguish == from = and explain short-circuit evaluation with a small example.
- Read a simple switch statement and recognize break and continue. Class check: test a passing-score condition with 59 and 60; write a condition for a score from 0 to 100.
Week 10 — Functions: C++’s Programming Modules
- Define, declare, and call a function. Distinguish formal arguments from actual arguments; trace passing by value, return values, and local scope.
- Introduce a reference as another name for an existing variable. Compare passing an int by value with passing it by reference; recognize a const reference as read-only access through that reference.
- Class check: write add(a, b), then predict whether changing an int formal argument changes the caller's variable.
Week 12 — Objects and Classes
- Review std::string by storing and printing a name. Then define a class with data members and member functions; explain objects, public and private access, and the dot operator.
- Use a constructor to set up an object. Compare initialization with assignment in the constructor body. Introduce member initialization lists and const member functions; trace when a local object's constructor and destructor run.
- Class check: create two Student objects and call show() on each. Explain why changing one student's score leaves the other student's score unchanged.
Week 14 — Class Inheritance
- Explain the is-a relationship, base and derived classes, and public inheritance. Access private base-class data through a public member function.
- Read the supplied member initialization list: construct the base-class part first, then initialize derived data members. Class check: explain Person(studentName) and reuse getName() when displaying a Student.
Week 16 — Review
Week 16 revisits data, compound types, pointers, loops, branching statements, functions, objects and classes, and class inheritance using the lab programs and short code-reading questions.
Textbook terminology: C++ Primer Plus, 6th Edition
Class tasks:
Theory weeks use a short exit check; lab assignments include instructions, starter code, and submission requirements. Submit a lab report for each lab. Extra homework is assigned only when needed.
Grading
Here’s more information about the class grade:
Breakdown
Below is the breakdown of the class grade:
- — 60%: Final Examination — open-book written examination.
- — 40%: Continuous Assessment — attendance, class performance, assignments, and labs.
COURSE MATERIALS
Learning Resources
TEXTBOOK REFERENCE
C++ Primer Plus, 6th Edition
Course topics and C++ terminology follow Stephen Prata’s English edition.
View Textbook Contents→
LOCAL ALIGNMENT
Chinese Course Materials
Local topic boundaries, examples and grading alignment.
MODERN EXAMPLES
PPP3 · LearnCpp · CS106L
Selected C++ explanations for containers, classes, streams and project organization.
ONLINE IDE
OnlineGDB
Write, compile, run, and debug C++ programs directly in your browser.
Open Online C++ Compiler
→
Course boundary:
move semantics, smart-pointer implementation, template metaprogramming, and advanced manual memory management are not core requirements.