- https://doi.org/10.1007/978-1-4471-2736-9_2
Flow of Control
- Jan 1, 2012
- Joe Pitt-Francis +1 more
In almost any computer program written for a scientific computing application we need to allow the computer to execute a collection of statements if—and only if—some criterion is met. For example, if we were writing a program to control the motion of a spacecraft travelling to Mars, the program would include lines of code that would control the safe landing of the spacecraft. It is imperative that the lines of code that instruct the motors to cut out are executed at exactly the right time. As with most programming languages, conditional branching may be achieved in C++ programs by using an if statement. Similarly we may use a while statement to execute a collection of statements until a specified condition is met, and a for loop to execute a collection of statements a specified number of times. This flow of control often depends on relations between operators (such as greater than) and on combinations of expressions (such as two conditions both being true). In this chapter we explain how to utilise these features of the C++ language.
- # Flow Of Control
- # Lines Of Code
- # Conditional Branching
- # Programming Languages
- # Safe Landing
- # Computer Program