6. Functions and an Introduction to Recursion

Form ever follows function.

—Louis Henri Sullivan

E pluribus unum. (One composed of many.)

—Virgil

O! call back yesterday, bid time return.

—William Shakespeare

Answer me in one word.

—William Shakespeare

There is a point at which methods devour themselves.

—Frantz Fanon

Objectives

In this chapter you’ll learn:

• To construct programs modularly from functions.

• To use common math library functions.

• The mechanisms for passing data to functions and returning results.

• How the function call/return mechanism is supported by the function call stack and activation records.

• To use random number generation to implement game-playing applications.

• How the visibility of identifiers is limited to specific ...

Get C++ How to Program, Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.