Every day, more and more people learn and use the C++ programming Language. I have taught C to thousands of students in my life.
I see many of those students now moving to C++ in their school work
or career. The C++ language is becoming an industry-accepted
standard programming language, using the solid foundation of C to
gain a foothold. C++ is simply a better C than C.
C++ By Example is one of several books in Que抯 new line of By
Example series. The philosophy of these books is simple: The best
way to teach computer programming concepts is with multiple
examples. Command descriptions, format syntax, and language
references are not enough to teach a newcomer a programming
language. Only by looking at numerous examples and by running
sample programs can programming students get more than just a
揻eel?for the language.
Table of Contents
Overview
I Introduction to C++
1 Welcome to C++
2 What Is a Program?
3 Your First C++ Program
4 Variables and Literals
5 Character Arrays and Strings
6 Preprocessor Directives
7 Simple Input/Output
II Using C++ Operators
8 Using C++ Math Operators and Precedence
9 Relational Operators
10 Logical Operators
11 Additional C++ Operators
III C++ Constructs
12 The while Loop
13 The for Loop
14 Other Loop Options
15 The switch and goto Statements
16 Writing C++ Functions
IV Variable Scope and Modular
Programming
17 Variable Scope
18 Passing Value
19 Function Return Values and Prototyping
20 Default Arguments and Function Overloading
V Character Input/Output and
String Functions
21 Device and Character Input/Output
22 Character, String, and Numeric Functions
Contents
x
VI Arrays and Pointers
23 Introducing Arrays
24 Array Processing
25 Multidimensional Arrays
26 Pointers
27 Pointers and Arrays
VII Structures and File Input/Output
28 Structures
29 Arrays of Structures
30 Sequential Files
31 Random-Access Files
32 Introduction to Object-Oriented Programming
VIII References
A Memory Addressing, Binary, and Hexadecimal Review
B Answers to Review
1