Unit 04 Deep Dive — Decision Making

← Course home · Problem-solving module · C++ Foundations · Unit 04 in the syllabus

Where this fits. You can already print, read, and calculate (Foundations, I/O), and you have thought through problems before coding (Problem Solving). Now your programs learn to choose: grading rules, ticket prices, bill slabs, eligibility checks. Decision making is where a specification stops being a description and becomes logic you can get wrong — so this unit is heavier on discipline than on syntax.

The one rule of this module

Try first. Every lesson’s practice, every exercise, every prediction, every lab task: write your decision, dry-run it on paper, then open the answer. A decision you borrowed is a decision you don’t own; on the next boundary case it will fail and you won’t know why.

The three-pass habit from Problem Solving applies to every exercise below:

  1. Restate the rule in plain words (which inputs, which outcomes).
  2. Decide on paper — a decision table or trace table, not code.
  3. Code it, then dry-run your code against the same table.

Module map

Part File You will be able to
Lesson 1 The decision statement write if, if-else, else-if ladders and nested decisions; name every part
Lesson 2 Conditions and boundaries build comparison, logical, and compound conditions; dodge boundary and range bugs
Lesson 3 Switch and the conditional operator choose switch vs ladder vs ?: honestly; write fallthrough-free switches
Lesson 4 From requirements to decisions convert any rule set: decision tables → flowcharts → pseudocode → C++ → dry runs
Practice 25 exercises · 10 debugging hunts · 10 predictions · 10 challenges rehearse until boundaries stop surprising you
Labs 8 realistic scenarios grading, electricity billing, cinema pricing, bank validation, age categories, admission, shipping, restaurant rules

Suggested pacing (Week 4 · 2 sessions + self-study)

Session Focus
4.1 Lessons 1–2 + exercises E1–E10 + Lab 1 or 2
4.2 Lessons 3–4 + predictions P1–P10 + Lab 3–5 (pick)
Self-study Debugging hunts D1–D10, remaining exercises, challenges C1–C10, Labs 6–8

Prerequisites checklist

What’s next

Unit 05 — Repetition: decisions that run inside loops — validation loops, sentinels, menus.