Module 1 - C++ is not the C Language -- Course IntroductionModule Overview
./../../private/data/1/header.jpg
./../../private/data/1/header2.jpg
./../../private/data/1/header3.jpg
×
1.) C++ is not the C Language -- Course Introduction
2.) C++ Batteries Included - STL and GDB Debugging with the STL
3.) Functions 1: Making our code more modular | GDB and Functions
4.) Input and Output
5.) C++: Thinking about memory
6.) Memory Allocation and Layout
7.) Arrays, Splines, and SFML Library Introduction
8.) Building Data Structures -- Structs and Linked Lists
9.) Physical Structure of a C++ Project
10.) No Class
11.) Graphics Applications, Textures, Images, Sprites, and 2D Arrays
12.) Object-Oriented Programming 1
13.) Object-Oriented Programming 2
14.) Object-Oriented Programming 3 - Composition & Inheritance
15.) Binary Tree Data Structure
16.) C++ Templates - Code Generation and Generics
17.) Smart Pointers and Quad Trees
18.) Iterators and Algorithms
19.) Concurrency and Threading
20.) Final Project Discussion
21.) Review/Functors/Lambda's/
22.) Graphs
23.) Holiday no class
24.) LValues, RValues, and Move Semantics
25.) Advanced Topic 1 - Scripting with C++ using Pybind11 and Lua
26.) C++ Tooling and C++ GUIs
27.) Course Wrap Up
☰ Select another Module

Audio/Video Recording

...

Readings/Warmup (Do before class)


Test Your Knowledge (Optional)

[Test your knowledge on the readings] (This is not graded)

...Commented Code Samples (if any)

For now I am linking code samples here: Github Code Repository for the course
...

Additional Resources


Slides


(Graded) In-Class Activity link

  • In-Class Activity Link
    • This is graded, and only your first response is graded
    • This is an evaluation of what was learned in lecture.
    • Due one week from when the lecture takes place

Module Content

Module Overview

In this module we start the course!


Module Outline

  • Lecture outline
    • Course Structure
    • Quick Examples in C++

Commentary

(Optional Notes)

Programming One Pixel at a Time: Modern C++

Introduction

Welcome! Welcome to your journey on learning a new programming language -- C++! But if you're reading this, you might not be here just for the language, you are here for the context of learning about pixels. Let me explain. In this text you are going to join me on a journey to learn Modern C++ -- one pixel at a time. Now there are two parts to that last statement, let's take break that down.

Modern C++

You are learning Modern C++ as a modern C++ programmer. Just like the languages we speak go through an evolution, programming languages additionally are constantly evolving. You are not learning 'C with classes', you are not learning the C++ I learned in University C++98, but you are learning a much more rich, modern, and expressive language. While I'm not sure how long we'll call it 'modern c++' that generally refers to the version of the language that is after C++ 11 (11, of course meaning 2011).

Note From all this time forward, when I refer to C++, assume that I mean 'Modern C++'.

One pixel at a time

The 'one pixel at a time' part of this course means we are primarily going to be building graphical applications as we learn C++. We'll start with a few applications on the console to make sure our systems are setup, as well as cover some foundational material--but soon enough you'll be creating graphical applications. The reason for this, is that I have found it incredibly motivating throughout my career to work on applications where I can 'see visually' the output with my own two eyes.

A little bit of History - C++

I believe when learning a new domain (in this case some computer graphics), and a new language (in this case Modern C++), that you should also know a little bit about the history. It will allow you to understand

https://en.wikipedia.org/wiki/Bjarne_Stroustrup

In June of 2020 Bjarne Stroustrup published in the History of Programming Languages a wonderful article talking about the evolution of C++ from 2006 to 2020 -- Thriving in a Croweded World. This article discusses some of the evolution in what is now Modern C++.

A little bit of History - Graphics

Getting Started with C++

Hello world is a classic program used to introduce folks to a programming language. It is seen as a minimally interesting program to test that you are able to program using a specific language with specific tools. So what better place for us to start?

Hello World

// @file hello.cpp
// g++ hello.cpp -o prog
#include <iostream>

int main(){

    std::cout << "Hello World\n";

    return 0;
}

Aside, with modern C++ we can put the function return type after main. This is the same program, but some folks prefer this syntax for readability. We'll look at more features and way to write code throughout this adventure.

// @file hello_trailingreturn.cpp
// g++ -g -std=c++11 -o prog
#include <iostream>

auto main() -> int{

    std::cout << "Hello World\n";

    return 0;
}

Hello World yet another look!

As I have mentioned, C++ is an 'evolving language'. At the time of this writing C++ 2023 has another way to output text using the 'print' function which would be familiar to you in many other programming languages (print in Python, println in Java, printf in C, etc.).

// @file hello23.cpp
// g++ -g -std=c++23 -o prog
int main(){

    std::print("Hello, World");

    return 0;
}

To see if you have a specific feature available, cppreference (a great resource that I'll often reference) that can show you which features are available. As an example, here is the C++ 23 compiler support feature matrix.

Feeling overwhelmed?

The truth is, that in Modern C++ is that we have a lot of different tools. The reality is, we don't have to use them all, and we'll want to slowly build up our knowledge of C++ programming.

So what is the C++ Programming Language?

  • It's a language that continues to evolve, currently every 3 years there's an update.
  • Successor language to C
    • Mostly compatible with C (i.e. a C++ compiler can usually just compile C code).
  • Strong Type System
  • Statically Typed language

Please do not redistribute or host any materials without e-mailing me first. I generally am happy to share the latest .pdf or slide presentation with those who ask. Thank you for your time!