
Chapter 6
Selection
6.1 Introduction
To completely describe an algorithm four design structures are used: sequence,
selection, repetition, and input/output. This chapter explains the selection structure
and the corresponding statements in pseudo-code and C statements for implementing
computational models.
Conditions are expressions that evaluate to a truth-value (true or false). Condi-
tions are used in the selection statements. Simple conditions are formed with rela-
tional operators for comparing two data items. Compound conditions are formed by
joining two or more simple conditions with logical operators.
The solution to a quadratic equation is discussed ...