will make, and your students will make, is putting = where you meant to put ==. Emphasize this at every
opportunity.
I remember after one class a student came up to me and said, “Steve, I have to admit that I thought you
were a little crazy going on and on about = vs. ==. That was until yesterday. You see I just wrote my
first C program for work and guess what mistake I made.”
Live Demonstration
Slide 12 fib/fib.cpp
Slide 14 total/total.cpp
Slide 16balance/balance.cpp
Review Questions
1. Define the following:
Branching Statements
Page 19
Looping Statements
if statement
else clause
relational operator
logical operator
while statement
Fibonacci number
break statement
Branching Statements
change the control flow of a program by executing one or more different branches
of the code.
Looping Statements
statements that cause the flow of the program to repeat or loop over a section o f
code.
if statement
a statement conditionally executes a block of code .
else clause
a clause at the end of an if statement that defines a section of code to be executed
if the condition in the if is not true.
relational operator
operators such as ==, !=, and <, that compare two values. These operators are used
to test the relationship between two values.
logical operators
Operators perform the logical functions “and,” “or,” and “not”.
while statement
a looping statement that will repeatedly execute a section of code until its
condition becomes false.
Fibonacci number
a number in a series that starts out with “1 1”. Each element of the series from
here on is the sum of the previous two numbers.
break statement
a statement that when executed exits a loop.
Page 20
Chapter 7: The
Programming Process
It’s just a simple matter of programming.
— Any boss who has never written a program.
Teacher’s Notes
At this point our students know enough to write programs. Very simple programs, but real, useful
Practical C++ Programming by manish baranwal
Start from the beginning
