Week 1 - Introduction to C++ Programming

Learning Objectives

Upon finishing this learning module, you should be able to:

  • Describe how a C++ program goes from source code to working program
  • Identify the functions of basic components of a C++ program
  • Use assignment and use the basic math operators

Curriculum Update Note

CS161 is getting a curriculum update this term. We are moving to a new interactive textbook and are updating some of the topics and tools we use in the course.

Some of the videos may feature slightly different tools or examples than what you are using and see in the book. Anything that is substantially changed I am rerecording, but there will be some videos that don't look exactly like what you will see as you do your work. So don't panic if something you see in a video is not exactly what you see in your tools or book.

Because this is a new curriculum, I expect there will be some rough spots that need to be smoothed out. If you find something that is confusing or doesn't work, please let me know so I can fix it for future students.


Schedule

Day 1

In class:

For next class:


Day 2

In class:

For next class:


Day 3

In class:

For next class:


Day 4

In class:

For next class:

  • Do Assignment 1


Course Intro

In Canvas, watch the welcome video, review the syllabus and fill out the background surveys.

The survey is your "proof of attendance". It must be completed by Wednesday of the first week of the term or you may be dropped from the course for non-attendance.

Access Book

Watch this video to see how to use the book and complete the book based assignments.

Not all assignments will be completed in the book. Canvas (Elearn) should be your primary source for assignments and due dates.


C++ & Development Basics

Work through Ch2.1-2.10.

This video talks through the Hello World example on 2.4 and demonstrates using the ActiveCode widget in the book:

For any video, you can click in the lower right corner to watch on YouTube. You can then use the settings icon there (Gear symbol at bottom of video) to watch at higher quality. Doing so can make a big difference when trying to read code examples.

Set Up a Codespace

To start with, we will be using GitHub Codespaces as our development environment. Eventually, you will learn how to set up a C++ development environment on your own computer, but Codespaces provide a simple way to get started programming in C++. They also have the advantage of allowing you to access your work from any computer with a web browser.

See the Codespaces guide for instructions on how to set up and use a Codespace.

I recommend setting up a Codespace that you use for testing. Any time you just want to test out a code sample or do an experiment, use your test Codespace. By reusing that same Codespace, you avoid having to spin up a new Codespace each time you want to test something.

When you are working on an assignment you will submit, create a separate Codespace for that assignment.


Using VS Code

Whether you are using a Codespace or, later on, a local installation, we will be using VS Code as our primary programming environment. This video introduces how to use it to write and run code:


Variables and Operators

Work through Ch 3.1-12.


The Debugger

The debugger is a CRITICAL tool for learning programming. This video shows how to use the debugger in a Codespace.


Development Intro

Read Ch 3.13-3.15.


Do Assignment 1

Start working on the first submitted assignment. It is listed as "Assignment 1" in Canvas.

Most weeks will include an assignment you will complete outside of the book and submit in Canvas. As part of starting the first assignment, you should make sure to read this document about the work history you must submit as part of every assignment.

There is a video in that document that shows how your work history is documented and how to inspect that history.

When you are complete, here is how to submit your assignment: