Skip to main content

2012 | OriginalPaper | Buchkapitel

2. Flow of Control

verfasst von : Dr. Joe Pitt-Francis, Dr. Jonathan Whiteley

Erschienen in: Guide to Scientific Computing in C++

Verlag: Springer London

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

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.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Fußnoten
1
Nobody knows what happened to the Mars Polar Lander in the last few seconds of its descent in 1999, but experts believe there was a bug in the landing gear sensor code. This bug involved accumulating weak signals from the landing gear and may have caused the retrorockets to cut out too early.
 
2
If p and q are the results of two calculations which ought to be equal, to within machine precision, then they many differ by about |p| × DBL_EPSILON, since DBL_EPSILON ∼2e–16 is defined in #include <cfloat> to be smallest double precision floating point number such that 1.0+DBL_EPSILON is not equal to 1.0 when rounding errors are taken account of.
 
Literatur
2.
Zurück zum Zitat Kreyszig, E.: Advanced Engineering Mathematics, 9th edn. Wiley, New York (2006) Kreyszig, E.: Advanced Engineering Mathematics, 9th edn. Wiley, New York (2006)
Metadaten
Titel
Flow of Control
verfasst von
Dr. Joe Pitt-Francis
Dr. Jonathan Whiteley
Copyright-Jahr
2012
Verlag
Springer London
DOI
https://doi.org/10.1007/978-1-4471-2736-9_2