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
Recommended Schedule
Day 1
- Type Conversions, Const, other Operators
- Do MentalCodeOpsCasts worksheet
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.8
- Do BooleanPractice WS
- Do assignment
Data Conversions and Other Operators
Read the last parts of chapter 2 (2.7, 2.11-13, and 2.16). These videos cover two of the topics, Casts and Constants:
Do the MentalCodeOpsCasts worksheet (see Classroom files link). Like last week, try doing in your head, then check it using the debugger.
One of your takeaways should be that the operators like ++ and += are pretty simple if you use them on a line by themselves. But, if you mix them into more complex expressions, they quickly get very tricky:
z += y /= --x + 6; //valid but insane c++
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.