Week 2 - Boolean Expressions and Conditionals
Learning Objectives
Upon finishing this learning module, you should be able to:
- Use relational operators to construct simple boolean statements
- Write a program using conditional expressions
Schedule
Day 1
- Holiday
Day 2
- Start Conditionals - complete through Ch 3.4
- Set up CPPLab
- CPP Lab conditionals 1
Day 3
- Continue Conditionals - complete through Ch 3.8
- CPP Lab conditionals 2
- Check out the assignment
Day 4
- Finish Conditionals - complete through Ch 3.16
- Do BooleanPractice WS
- Do assignment
Multiple File Sample Projects
If you look at the sample code for week 2 from the CS161 git repository, you will notice that some project folders have extra text files with the extension ".bak" after the filename.
The .bak files have alternative samples. Rather than make 3 different projects to show off 3 closely related samples, there is just one project with the different samples stored in those "backup" files.
The .bak
files will not be compiled. To switch which sample you
are building and running, simply copy all the code from one of the .bak
files and paste
it into the main.cpp file, replacing the code that was there.
CPPLab
We will be using a website called CPP Lab to be getting programming practice.
Follow this guide to get logged into CPPLab and learn about it.
Some of the problems are easy, some are hard. Your goal should be to attempt all the problems in each problem set and, hopefully, complete all of them. But if you get stuck, don't spin your wheels for hours trying to solve a particular problem. Move on to something else and get help with that one.
Conditionals
Read Ch 3.1-3.4. This video introduces some of the key concepts:
Watch this video on the concept of Scope:
Do Conditionals 1 CPP Lab
Read Ch 3.5-3.8. This video introduces some of the ideas:
Do Conditionals 2 CPP Lab .
This video demonstrates using the debugger to trace your way through the computer tax example:
Read Ch 3.10-11 and 3.13-16.
Note: you do not need these parts of Chapter 3 to do the assignment or CPPLabs. Next week involves less material, if necessary you can worry about mastering these section next week.
These videos cover the basics of those sections:Do the Boolean Practice worksheet (Remeber that the Files link in Elearn/Canvas is where you can access this and future worksheets).
Do the assignment.