List of Programs List of Figures Preface I. PROCEDURES The Basics What is C++? Hello C++ Numbers The Integer Types The Real Number Types The bool and char Types Checking the Size and Capacity of the Different Types Standard Operations Comparisons and Boolean Operations Complex Numbers Naming Variables Greatest Common Divisor The Problem A First Approach Euclid's Method Looping With for, while, and do An Exhaustive Approach to the GCD Problem Extended GCD, Call by Reference, and Overloading Random Numbers Pseudo Random Number Generation Uniform Random Values More on Pseudo Random Number Generation A Monte Carlo Program for the GCD Problem Normal Random Values Arrays Euler's Totient Array Fundamentals A Procedure to Factor Integers A Procedure to Calculate Euler's Totient The Sieve of Eratosthenes A Faster Totient Computing pn for Large n The Answer II. OBJECTS Points in the Plane Data and Methods Declaring the Point Class Data Hiding Constructors Assignment and Conversion Methods Procedures using Arguments of Type Point Operators Pythagorean Triples Generating Pythagorean Triples Designing a Primitive Pythagorean Triple Class Implementation of the PTriple Class Finding and Sorting the Triples Containers Sets Set Iterators Multisets Adjustable Arrays Via the Vector Class Ordered Pairs Maps Lists, Stacks, and Assorted Queues Modular Arithmetic Designing the Mod Type The Code The Default Modulus: Static Class Variables and Methods Constructors and Get/Set Methods Comparison Operators Arithmetic Operators Writing Mod Objects to Output Streams A Main to Demonstrate the Mod Class The Projective Plane Introduction to the Projective Plane, RP2 Designing the Classes PPoint and PLine Inheritance Protected Class Members Class and File Organization for PPoint and PLine The Parent Class PObject The Classes PPoint and PLine Discovering and Repairing a Bug Pappus Revisited Permutations Ulam's Problem Designing the Permutation Class Finding Monotone Subsequences Exercises Polynomials Procedure Templates Class Templates The Polynomial Class Template The GCD Problem Revisited Working in Binary III. TOPICS Using Other Packages Arbitrary Precision Arithmetic: the GMP Package Linear Algebra Other Packages Strings, Input/Output, and Visualization Character Arrays The String Class Command Line Arguments Reading and Writing Data in Files String Streams Formatting A Class to Parse Files Visualization Odds and Ends The switch Statement Labels and the goto Statement Exception Handling Friends Other Ways to Create Types Pointers IV. APPENDICES A. Your C++ Computing Environment Programming with a Command Window and a Text Editor Programming with an Integrated Development Environment General Advice on Debugging B. Documentation with Doxygen Doxygen Comments Using Doxygen C. C++ Reference Variables and Types Operations Control Statements Procedures Classes Standard Functions D. Answers Index *Each Chapter Contains Exercises Solutions can be found in Appendix D