Skip to Content
Programming: Principles and Practice Using C++, 2nd Edition
book

Programming: Principles and Practice Using C++, 2nd Edition

by Bjarne Stroustrup
May 2014
Beginner
1312 pages
38h 36m
English
Addison-Wesley Professional
Content preview from Programming: Principles and Practice Using C++, 2nd Edition

4. Computation

“If it doesn’t have

to produce correct results,

I can make it arbitrarily fast.”

—Gerald M. Weinberg

This chapter presents the basics of computation. In particular, we discuss how to compute a value from a set of operands (expression), how to choose among alternative actions (selection), and how to repeat a computation for a series of values (iteration). We also show how a particular sub-computation can be named and specified separately (a function). Our primary concern is to express computations in ways that lead to correct and well-organized programs. To help you perform more realistic computations, we introduce the vector type to hold sequences of values.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming: Principles and Practice Using C++, 3rd Edition

Programming: Principles and Practice Using C++, 3rd Edition

Bjarne Stroustrup
C++ How to Program, 10/e

C++ How to Program, 10/e

Paul Deitel, Harvey Deitel

Publisher Resources

ISBN: 9780133796759Purchase book