Lecture Topics & Homework
Week 17: Pointers, Memory & Final Review
Hooray! Your last week of class. This week we will discuss pointers and we will review what we've learned this semester.
There are tutoring sessions this week, as usual.
Lecture 29: Pointers
Today we will discover what pointers are and how they work. Focus on the fundamentals of pointer syntax, and how to interpret * and &.
Homework due May 2:
- Read Etter chapter 9, pages 397 - 406
- Optional reading: pages 407 - 429
Lecture 30: Semester Review
Holy cow! Your final class for the semester. Today we will be reviewing what we have learned and give you some tips for preparing for the final exam.
- Begin studying for the final exam. (see the review sheet)
- Complete the final project (due May 9, no exceptions!).
No lab on May 4.
The exam is at 1PM and should take approximately two hours to complete. See the exam page for locations.
Final Project due in blackboard on May 9 by 11:59PM.
Be sure to see this post about your submission.
Week 16: Simulations, Memory Management
This week you will be responsible for implementing a simple simulation using your own functions and classes. We will also be exploring a program's use of memory in more detail. C++ is known as a language that places you "close to the metal." As such, it allows us to begin to learn about how computers actually work and we will equip you with some knowledge of your program's use of memory.
Lecture 27: Simulations, Random Walk
Today you will learn about the importance of software as a mechanism for creating simulations and why simulation is a critical aspect o engineering. In addition, we will present the Random Walk (aka Drunkard's Walk) phenomena and see if you can create a simulation to help deduce an answer.
Homework due Apr 25:
Lecture 28: Memory Addresses
Like any good car mechanic, we need an understanding of how the machine works in order to be effective. Today we will explore how values are stored in memory and how you can use the & ("address of") operator to inspect these values.
Homework due Apr 27:
Lab 14: OpenFrameworks Events
This week you learned a little about "events" such as key-presses and mouse clicks. For this lab, you will implement some event handlers that allow you to control things on the screen. Learn about how a framework's event-handlers (functions) make it easy for you to control how your program works according to user input.
Homework due Apr 30:
Week 15: Pass-by-Reference, Concept Review and Exam II
Take a look: you've now written over 25 programs and have learned about programming concepts that almost all modern programming languages provide. And your brain is still intact! This week, we will learn about references, how objects and values are stored in memory, why you should usually pass objects by reference. We'll also be covering section 5.3 of our book. In addition, we will review all of our concepts, practice what we've learned and prepare to ace the midterm exam.
Lecture 25: Pass-by-Reference, Objects & Memory
To date, we have explained that function scope is independent: "what happens in braces stays in braces." However, there are cases where we want a function to be able to modify the actual piece of data it is passed. This is often the case when using functions that receive objects as arguments. Today, learn a little more about memory and how to declare functions that receive their arguments by reference. We will implement a simple troll battle and also cover section 5.3 of our book.
Homework due Apr 23:
- Read Etter 5.3
Lecture 26: Review
Today we will be reviewing our concepts and giving you a taste of what to expect on the second midterm exam.
No homework. Study for the exam.
The exam is at 6:30PM and should take approximately one hour to complete. See the exam page for locations.
No lab on Apr 20.
Week 14: Defining Your Own "Things" to the Machine (Intro to Classes)
You've now been introduced to four different objects: strings, vectors, Persons and Books. You learned how to create instances of objects and how to use the "dot operator" to access an object's properties. This week, learn how to describe your own "things" to the machine by declaring classes.
Lecture 23: Introduction to Classes
Now that you know how to instantiate and use objects, learn how you can define your own types of things through a mechanism we call "class definition." Today you will learn what a class is, the difference between objects and classes, and how to define classes that represent real-world things to the machine. We will also be covering chapter 8 of our book.
Homework due Apr 11:
- Read Etter 8.1, 8.2 and 8.4 (skip 8.3)
Lecture 24: More about Classes
Now that you can define a basic class with properties and constructors, today you will learn how to define "constants" across an entire class of things, define member functions, the difference between public and private access, and the getter/setter pattern. You will enhance your initial Box class to ensure it cannot have negative attributes, and you will enable Boxes to "tell you" their volume.
Homework due Apr 13:
- Continue reading Etter 8.1 - 8.4 (skip 8.3)
Lab 13: Moving Squares
Leverage what you have learned about classes this week to create a program in which you define what it means to be a "square" that can move, and create an animation that demonstrates the properties of a collection of Squares.
Homework due Apr 16:
- Finish reading Etter 8.1 - 8.4 (skip 8.3)
Week 13: Objects
While numbers and letters are represented as primitive values, this week you will learn how to use more "complex" and meaningful abstractions: objects. Objects can be used in programs to abstract and represent real-world things. This week you will learn about how to use objects through the API they provide.
Lecture 21: Objects and Strings
Today you will learn more about what it means to be "an object" to the machine. Get comfortable using objects first, and next week you will learn how to define your own (more exciting) objects to the machine. Today we will explore string objects and how you can use them more effectively in your programs.
Homework due Apr 4:
Lecture 22: Vector Objects
While arrays have their place, in most contexts you will want a data structure that is somewhat more flexible. Today you will learn about vectors and how you can use them instead of arrays.
Homework due Apr 6:
- Read Etter 8.5
Lab 12: Object Instantiation & Simple Simulations
Today's lab teaches you about different ways to instantiate (create) objects, and challenges you to experiment with an unfamiliar API. Create a program that simulates the process of reading a book.
Homework due Apr 9:
Week 12: Multi-Dimensional Data Structures & Program Design
This week, learn about multidimensional arrays and how to work with two-dimensional arrays. At the end of the week, you will use everything you have learned thus far to create a meaningful program. The important concepts this week are multi-dimensional arrays. We're also reading parts of chapter 7 from our book.
Lecture 19: Multi-dimensional Arrays
You should now be fairly comfortable with arrays that store primitive data, such as numbers. What happens when arrays "contain" arrays? Today you will learn about two-dimensional arrays and some common uses and patterns. Exercise your ability to work with two-dimensional arrays by creating a colorful grid of squares.
Homework due Mar 28:
- Read Etter 7.1
Lecture 20: Top-Down Program Design
Today's topic and assignment is designed to test you on your ability to design a complete program that exercises everything you have learned in the semester. Create a program that reads in some data and displays some frequency statistics by drawing a bar graph.
Homework due Mar 30:
- Finish reading Etter 7.1
Homework due Apr 4:
No new homework -- complete 22_letterFrequency.
Week 11: Collections of Things (Data Structures and One-Dimensional Arrays)
Before break you met a simple C++ data structure: the array. This week, continue to exercise array syntax for accessing and assigning array elements. The important concepts this week are how to declare arrays, how to put things in arrays, and how to access things that are in the array.
Lecture 17: Exam Review, Array Recap
Today we'll be getting things moving again with a review of arrays. We will also review the midterm exam.
Homework due Mar 21:
- Review Etter 6.1
Lecture 18: Arrays and Loops
Today we are introducting a common idiom in programming using arrays and
for loops. Exercise your ability to define functions and your ability to create, use and iterate over array structures.
Homework due Mar 23:
Lab 10: Letter Frequency
Have you ever finished a book and wondered, "Geez, how many times does the letter Q occur in this text?" No? Today's lab illustrates a fundamental use of the array: storing related values in a single data structure, and then using that data structure to reveal interesting facts about the data.
Homework due Mar 26:
Week 10: Spring Break
No class. Just sleep. Yay!
Week 9: Concept Review, Exam I, Intro to Arrays
So far in your programs, you've been dealing with individual pieces of data. This week, learn how to create collections of data using a simple data structure: the array. But first, we will review all of our concepts and prepare to ace the midterm exam.
Lecture 15: Review
Today we will be reviewing our concepts and giving you a taste of what to expect on the first midterm exam.
No homework! Study for the exam.
The exam is at 6:30PM. See the exam page for locations.
Lecture 16: Introduction to Arrays
A critical element in computer science is the "data structure": something that can store multiple pieces of data together. For example, we might want to create a "list" of football scores, or temperature readings. Today you will be introduced to a fundamental data structure called an array. We will learn about how arrays work, how to create one, store things in it, and access the things stored inside of it.
Homework due March 9:
- Read Etter 6.1
Lab 9: Wrap-Up
Want to forget about C++ over spring break? Be sure attend this lab to get help finishing 19_meetArray.
No new homework! Enjoy your spring break.
Week 8: Recursion, Functions & Memory, Concept Review
If you've gotten this far and your brain hasn't melted too much, then congratulations. Learning how to program is not easy. This week, we will start with a brain-bender: functions that call themselves. We will also be investigating the relationship between functions, memory and computational complexity. The important concepts this week are more function definitions and use, and recursion. We will also begin to review all of our concepts, practice what we've learned and prepare to ace the midterm exam. The lab this week is optional, with no new assignment for the weekend. Use this Friday's lab to get extra help before the exam.
Lecture 13: Recursion
You should now be comfortable with declaring functions and calling functions; with the difference between parameters and arguments; global and local scope; and how functions encapsulate "units of work" that you can use over and over again. Today we are demonstrating an important concept in computer science that is certain to melt your brain: functions that call themselves, also known as "recursion."
Homework due Feb 29:
Lecture 14: Intro to Computational Complexity and Algorithm Analysis
What determines if a program is "good" or not? In computer science, one aspect of measuring a program's "goodness" is to estimate how well it works when provided some incredibly large input. Today you will be introduced to "Big O" notation and we will analyze your factorial function. We will also begin reviewing for the midterm exam.
Homework due March 2:
- 18b_analysis (see blackboard)
Lab 8: Review and Extra Help (Optional)
This lab is optional and there will be no new homework assignment (study for the midterm!). We highly recommend attending if you need to finish 18b_analysis or would like some help with the review sheet or any other exciting C++ topics we've covered to date.
No homework. Study for the midterm exam.
Week 7: Functions, Libraries and a Taste of Recursion
You have now begun to learn about how functions allow you to write a bit of code once and re-use it. You have also seen how functions result in more readable programs, and how using libraries built by others allows you to write productive programs. This week we will be continuing our practice with defining and using functions.
No class on Feb 20. Yay!
Lecture 12: Functions and Scope
It takes time to get comfortable with parameters vs. arguments and to gain an understanding of function "scope." Today you will learn about "global" scope vs. "local" scope and a common use of global variables: to declare constants that multiple functions may need to use. In addition, we will be practicing more with functions and begin to test your knowledge with questions similar to what you can expect on the midterm exam.
Homework due Feb 24:
- Read Etter page 204
Lab 7: Function Prototypes
This lab exercises your knowledge about function prototypes, and how to declare prototypes above main and placing implementations below it. We revisit our "dating diary" program for a little romantic refactoring.
Homework due Feb 27:
Week 6: Abstraction, Encapsulation and Functions
You have now learned about the fundamental concepts needed to write useful programs. This week you will begin to learn about a key abstraction in programming: the function. Think of how meaningful function names help your programs read more like human language, and how functions are like "mini programs" that abstract the work that they do, letting you focus on how to use them, not how they do their work. The important concepts this week are how to use and define functions; and what "scope" is all about. We're also covering part of chapter 5 of our book.
Lecture 10: Functions
You've learned the nuts and bolts of programming, now learn about how to combine those nuts and bolts into more effective, readable, maintainable programs. Today you will learn about what functions are, how to use them and how to define them.
Homework due Feb 15:
- Read Etter 5.1, 5.2 and 5.3 through page 198.
Lecture 11: More FUNctions
Getting our heads around functions takes time and practice. Today we will practice defining and calling functions, discuss more about parameters and arguments, how arguments are passed by value, and what this thing called "scope" is all about. You will also learn about how to use function prototypes above main and definitions below.
Homework due Feb 17:
- Continue reading Etter 5.1 - 5.3 (p198)
Lab 6: Mines Dating Diary
Exercise your ability to design functions that are reusable. In this lab you will create a program that records your very busy dating history here at Mines. You will use functions to abstract away low-level "busy work," resulting in a
main() program that is easy to read (even for your programming date).
Homework due Feb 20 Feb 22:
- Finish reading Etter 5.1 - 5.3 (p198)
Week 5: Data, Input/Output
You've learned how a program can be "interactive" by accepting keyboard input and printing information to the screen. This week you will take a first step toward automation and persistence, creating programs that can read lots of data from files and write data to files. Think of how the data "outlives" the execution of the program. The important concepts this week are how to read and write data. We're also covering sections 4.2 and 4.5 of our book.
Lecture 8: Reading Data
You've learned how to provide the machine information interactively via the keyboard. But what if you need to provide a machine lots of information? How does a program like iTunes read an .mp3 file and generate music? Today you will learn how to create programs that can read data from text files and act upon that data.
Homework due Feb 8:
- Read Etter 4.2
Lecture 9: File I/O in Detail, Writing Data
Have you ever thought about how the information your programs print to the screen just "disappear" once the program ends? What if you wanted to "keep" the output from your program around for later use? We call this "data persistence," in its most simple form. Now that you've learned how to read data, today you will create a program that writes information to a text file.
Homework due Feb 10:
- Read Etter p144 - 145, and 4.5
Lab 5: Simple Stats
Now that you've learned how to read and write data, consider how much of the data we see is presented in a tabular format of rows and columns. Rather than process each piece of data individually, you often need to extract multiple pieces of data in one "row." Learn how to chain the >> operator with your loops to act upon rows of data.
Homework due Feb 13:
Week 4: Doing Things Repeatedly (loops with
Recall what we said about computers being very good at doing repetitive tasks. This week you will learn how to tell the computer to do things repeatedly, and how to modify what the computer does during each repetition. The important concepts this week are to understand common loop "patterns," and how to use C++ loop syntax to model repetitive tasks. We're also covering sections 3.4 and 3.5 of our book.
Lecture 6: Loops with
Today you will learn about how to teach the machine to complete repetitive tasks, which computers are incredibly good at doing. Today you will learn to think about "stopping conditions" and how to modify each task repetition. Understand how to implement loops with
while and recognize common looping patterns.
Homework due Feb 1:
- Read Etter 3.4
Lecture 7: Loops with
for and Intro to Machine Randomness
Another useful tool for implementing repetitive tasks is the
for loop. Learn about the similarities between
for loops and how to convert a
while loop to a
Homework due Feb 3 Feb 6:
- Finish reading Etter 3.4
Lab 4: Number Guessing Snow Day! No Class.
Exercise what you've learned over the past two weeks by creating every aspiring game programmer's first game: guess-the-number. Don't be fooled, it's not as simple as you might think. Exercise using
rand() and both loops and selection statements together.
Homework due Feb 6 Feb 10:
- Read Etter 3.5
Week 3: Making Decisions (Boolean logic and Selection Statements)
Now that you've learned how to teach the computer about simple facts in the world and exercised some basic C++ syntax, it's time to do something more useful: teaching the computer how to make decisions, given what it understands about the world. Your goal at the end of this week is to implement a game of Rock, Scissors, Paper. The important concepts this week are to understand that boolean expressions get evaluated and yield a value and how to use selection statements to model logical decision-making. We're also covering 3.1 and 3.2 of our book.
Note: be sure to download this week's assignment pack.
Lecture 4: Boolean Logic
First, review operations with mixed types: it seems trivial but it's something that all programmers tend to overlook. Next, learn about the life and death of George Boole, it's a sad story (yet somehow we'll laugh, in honor of his great work of course). Learn about boolean logic and how any decision can, in theory, be reduced to a Boolean expression. Learn about truth tables, logical expressions and how
false are representations of 0 and 1.
Homework due Jan 25:
Lecture 5: Selection Statements
Today you will learn about how to teach the machine to make decisions based on Boolean logic. Understand how to use selection statements with
else if and
else. Learn how to model more complex decisions with nested selection statements, and exercise your understanding of how computers represent character data.
Homework due Jan 27:
- Read Etter section 3.3
Lab 3: Rock, Paper, Scissors: Fight!
Exercise what you've learned this week by creating a simple console-based game of Rock, Paper Scissors. This assignment tests your ability to implement more complicated logic, your understanding of how computers handle character data, and how to use pseudocode to help guide your program development.
Homework due Jan 30:
Week 2: Programming Fundamentals (Variables, Operators, Expressions)
Last week you learned that we can "teach the computer about facts in the world that don't change"; the keyword
const; and how to compile and run a program in VS. The goal of this week is to introduce you to some basic syntax rules about C++, how to declare facts about the world that do change, and how to combine those facts with operators to create expressions. Your goal is at the end of this week is to enhance an existing graphical program such that it can successfully interpolate a value between two points of data. The important concepts this week are to know how to declare and use variables and expressions. We're also covering chapter 2 of our textbook.
Lecture 2: Compilation Process, Program Anatomy, Intro to Variables, Expressions & I/O
Understand how "code" becomes programs through compilation, linking and execution (what happens when you hit ctrl-F5). Grasp the general anatomy of simple C++ programs. Learn how variables are used to declare "facts that may change" and learn what
Homework due Jan 18:
- Start reading Etter chapter 2.
Lecture 3: C++ Fundamentals
Today you will learn about some basic C++ syntax rules. Understand how to declare variables using proper syntax. Learn about primitive operators such as addition and multiplication. Learn how to combine operators and variables to form expressions.
Homework due Jan 20:
Lab 2: Linear Interpolation
Exercise what you've learned this week by improving a graphical program that calculates an interpolated value between two points of data. This is a useful skill for many engineering contexts.
Homework due Jan 23:
Week 1: The Start of a Journey
Welcome to 261! The goal of this week is to dive in and compile your first program. The important concepts this week are to know how to compile and run a program with Visual Studio and how to define "constants" in code. We're also covering chapter 1 of our textbook.
Lecture 1: Introduction, Declaring Facts
Understand that real-world constants represent "facts that don't change," which become const declarations in C++. Know how to recognize a C++ "constant."
Homework due Jan 13:
Lab 1: Hello World!
Learn how to compile and run a C++ program using Visual Studio. Recognize and modify constants. Learn how to properly submit all programming assignments.