Advertisement

Flow of Control

  • Joe Pitt-Francis
  • Jonathan WhiteleyEmail author
Chapter
  • 9.7k Downloads
Part of the Undergraduate Topics in Computer Science book series (UTICS)

Abstract

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.

Keywords

Safe Landing Landing Gear Valid Syntax Integer Variable Count Break Code 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

References

Mathematical Methods and Linear Algebra

  1. 2.
    Kreyszig, E.: Advanced Engineering Mathematics, 9th edn. Wiley, New York (2006) Google Scholar

Copyright information

© Springer-Verlag London Limited 2012

Authors and Affiliations

  1. 1.Department of Computer ScienceUniversity of OxfordOxfordUK

Personalised recommendations