Professional Documents
Culture Documents
Absolute C 6th Edition Savitch Solutions Manual
Absolute C 6th Edition Savitch Solutions Manual
https://testbankfan.com/download/absolute-c-6th-edition-savitch-solutions-manual/
Chapter 2
Flow of Control
Key Terms
Boolean expression
&& means “and”
|| means “or”
truth tables
parentheses
precedence rules
higher precedence
short-circuit
complete evaluation
integers convert to bool
if-else statement
parentheses
if-else with multiple statements
compound statement
if statement
indenting
multiway if-else
switch statement
controlling expression
break statement
default
enumeration type
conditional operator
conditional operator expression
loop body iteration
while and do-while compared
executing the body zero times
comma operator
comma expression
for statement
empty statement
infinite loop
continue statement
ifstream
stream
file input
text file
Brief Outline
2.1 Boolean Expressions
Building Boolean Expressions
Evaluating Boolean Expressions
Precedence Rules
2.2 Branching Mechanisms
If-else Statements
Compound Statements
Omitting the else
Nested Statements
Multiway if-else Statement
The switch Statement
Enumeration Types
The Conditional Operator
2.3 Loops
The while and do-while statements
Increment and Decrement Operators Revisited
The Comma Operator
The for statement
The break and continue statements
Nested Loops
2.4 Introduction to File Input
Reading from a Text File Using ifstream
This chapter discusses flow of control using both selection and iteration. The if-statement and
loops are introduced both in this chapter. With both topics in one chapter, it is conceivable that
this chapter will take longer for students to work through than many of the others in the text.
Branching, or selection, is introduced using the if-else statement, the if statement, and the switch
statement. Multiple paths and therefore, nested if-else statements are introduced. As the last
form of selection available, the conditional operator is introduced at the end of the chapter.
Although many students choose not to use this operator, it is useful to cover so students can read
code that does use it.
With the introduction of looping and selection, students can write fairly complex programs at the
end of this chapter. However, what usually begins to happen is that students will write code that
has errors. Finding these errors can be tedious and time-consuming. The sections on common
pitfalls (infinite loops, semicolon at the end of for loops, etc.) should be covered as an
The section on file input allows students to write programs that use real-world data. This is
significant because it allows students to move beyond toy problems. The book has several
problems based on a list of English words. Although this section requires some “magic” code
that is not fully explained until later, students should be able to grasp the basic concepts of
reading from a text file and can begin writing program that operate on large amounts of data.
2. Key Points
Boolean Expressions and Relational Operators. The Boolean operators && and || are
introduced along with ! and their use with ==, !=, <, >, <=, and >=. Truth tables and building
complex Boolean expressions are important for the students to learn how to construct. In
addition, students must also learn the precedence rules associated with these operators.
If-else statement & Multiway if-else Statement. There are many ways to give the program a
sense of choice or branching. First, we can use an if-statement by itself without an else. This
allows us the option to do something or skip over it. We can also use an if-else statement, which
allows us to take one path or another. Lastly, we can use combinations of these to have more
than two choices for execution. As the number of paths increase, so does the complexity of code
for the students. Students should be able to follow as well as write these more complicated
branching code segments.
The switch Statement. The switch also allows for branching, but it has limitations as to what
the condition for branching can be. Also, the syntax contains more keywords and is more
structured than the if-else. Discussion of the break statement is needed here as the switch will
not function properly without the correct use of break between the cases.
true and false are numbers. True and false can be represented as the numbers 1 and 0. This is
sometimes used by setting a variable equal to the result of an Boolean expression, or by testing a
variable inside an if-statement.
Syntax for while and do-while Statements. The while and do-while loops are the indefinite
loops supported by C++. They also illustrate the differences between an entry-test and an exit-
test loop.
The for Statement. The for loop is a definite loop or counting loop that is also an entry-test
loop. The syntax for the for loop is different from the other two loops and has a loop counter
built right into the construct. However, in C++, we can have more than one statement inside
the parts of the for-loop separated by commas and we can also leave parts empty, which can
create many different results when using a for-loop.
THE SCANDAL.
THE CLAIMS.
“If you would ‘secure the blessings of liberty to ourselves and our
posterity,’ there must be some place reserved in which, and upon
which, posterity can exist. What will the blessings of liberty be worth
to posterity if you give up the country to the Chinese? If China is to
be the breeding-ground for peopling this country, what chance of
American posterity? We of this age hold this land in trust for our race
and kindred. We hold republican government and free institutions in
trust for American posterity. That trust ought not to be betrayed. If
the Chinese should invade the Pacific coast with arms in their hands,
what a magnificent spectacle of martial resistance would be
presented to a startled world! The mere intimation of an attempt to
make conquest of our western shore by force would rouse the nation
to a frenzy of enthusiasm in its defense. For years a peaceful, sly,
strategic conquest has been in progress, and American
statesmanship has been almost silent, until the people have
demanded action.
“The land which is being overrun by the oriental invader is the
fairest portion of our heritage. It is the land of the vine and the fig
tree; the home of the orange, the olive, and the pomegranate. Its