A First Book of C++
Gary Bronson
West
1995
0-314-04236-9
??






Exactly as it states, this is for those who are just starting out in C++. It doesn't clearly stress program structure or abstraction as much as the others, but it does stress Object Oriented Design. Each chapter focuses on one specific portion of the language with Common Programming Errors highlited at the end of each chapter. Strewn throughout the book are tables and snippets of code that effectively get the point across and show how the particular subject is used. Some neat features include a pullout reference list with C++ keywords, operators, classes,stuctures and arrays and how they are used. Also included is a 3.5 disk with all of the example program files. This is a good book for those that want to learn the language first before trying to tackle programming techniques. It does give you technique through its examples, but as noted before, it doesn't accent program stucuture or abstraction as much as others. In the Preface, the author states from his own experience that it is easier and much more rewarding to learn syntax before program design. Following that line of thought, he did a good job.



Chapter 1	Getting Started

1.1	Introduction to Pgrogramming						2
	Algorithms and Procedures						4
	Classes and Objects							8
	Program Translation							9

1.2	Function and Class Names						11
	The main() Function							14
1.3	The cout Object								16

1.4	Programming Style							20

	Comments								21
1.5 	Common Programming Errors						24

1.6 	Chapter Summary								25


Chapter 2	Data Types, Declarations, and Displays	

2.1	Data Constants								28
	Integer Values								28
	Floating Point Numbers							29
	Exponential Notation							30
	Character Constants							30
	Escape Sequences							31

2.2	Arithmetic Operators							33
	Integer Division							35
	Negation								35
	Operator Precedence and Associativity					35

2.3	Numerical Output Using cout						38
	Formatted Output							40

2.4	Variables and Declarations						48
	Declaration Statements							50
	Multiple Declarations							53
	Reference Variables							55
	Specifying Storage Allocation						58

2.5	Integer Qualifiers							63
	Data Type Conversions							65
	Determining Storage Size						66

2.6	Common Programming Errors

2.7	Chapter Summary

2.8	Chapter Supplement-Bits, Bytes, Adresses, and Number Codes		69
	Words and Addresses							70
	Two's Complement Numbers						70


Chapter 3	Assignment and Interactive Input

3.1	Assignment Statements							74
	Assignment Variations							79
	Accumulating								80
	Counting								81

3.2	Mathematical Library Functions						85
	Casts									90

3.3	The cin Object								92

3.4	The const Qualifier							99
3.5	Common Programming Errors						102
3.6	Chapter Summary								103


Chapter 4	Selection

4.1	Relational Expressions							106
	Logical Operators							108
	A Numerical Accuracy Problem						110
4.2	The if statements							112
	Compound Statements							114
	Block Scope								116
	One-Way Selection							117
	Problems Associated with the if-else Statement				118

4.3	Nested if Statements							121
	The if-else Chain							122
4.4	The  switch Statements							128
4.5	Common Programming Errors						134
4.6	Chapter Summary								135
4.7	Chapter Supplement: Errors, Testing, and Debugging			138
	Compile-Time and Run-Time Errors					138
	Syntax and Logic Errors							138
	Testing and Debugging							141


Chapter 5	Repetition Repetition :)

5.1	The while Statement							146
5.2	cin Within a while Loop							154
	Sentinels								160
	break and continue Statements						162
	The NULL Statment							163

5.3	The for Statement							165
	cin Within a for Loop							171
	Nested Loops								172

5.4	The do Statement							178
	Validity Checks								179

5.5	Common Programming Errors						181

5.6	Chapter Summary								182


Chapter 6	Writing Your Own Functions

6.1	Function and Argument Declarations					186
	Function Prototypes							187
	Calling a Function							188
	Defining a Function							189
	Default Arguments							193
	Reusing Function Names(Function Overloading)				194

6.2	Returning Values							196
	Inline Functions							202

6.3	Call by Reference							206
	Passing and Using References						206

6.4	Variable Scope								215
	Global Scope Resolution Operator					218
	Misuse of Globals							220

6.5	Variable Storage Class							222
	Local Variable Storage Classes						223
	Global Variable Classes							227

6.6	Common Programming Errors						230

6.7	Chapter Summary								231


Chapter 7	Arrays

7.1	One Dimensional Arrays							234
	Input and Output of Array Values					238

7.2	Array Initilization							244

7.3	Arrays as Arguments							247

7.4	Two Dimensional Arrays							252
	Larger Dimensional Arrays						259

7.5	Common Programming Errors						262

7.6	Chapter Summary								262

7.7	Chapter Suplement: Sorting Methods					263
	Selection Sort								264
	Exchange Sort								266

Chapter 8	Pointers

8.1	Addresses and Pointers							270
	Storing Addresses							273
	Using Addresses								273
	Declaring Pointers							275
	References and Pointers							276

8.2	Array Names as Pointers							281
	Dynamic Array Allocation						286

8.3	Pointer Arithmetic							289
	Pointer Initilization							293

8.4	Passing Addresses							295
	Passing Arrays								300
	Advanced Pointer Notation						303

8.5	Commmon Programming Errors						308

8.6	Chapter Summary								310



Chapter 9	Character Strings

9.1	String Fundamentals							314
	String Input and Output							314
	String Processing							317
	Character by Character Input						318

9.2	Pointers and Library Functions						322
	Library Functions							327

9.3	String Definitions and Pointer Arrays					329
	Pointer Arrays								331

9.4	Common Programming Errors						335

9.5	Chapter Summary								336



Chapter 10	Records as Data Structures

10.1	Single Structures							341

10.2	Arrays of Structures							346

10.3	Passing and Returning Data Sturctures					350
	Passing a Pointer							353
	Returning Strutures							355

10.4	Linked Lists								358

10.5	Dynanmic Structure Allocation						367

10.6	Unions									373

10.7	Common Programming Errors						376

10.8	Chapter Summary								376



Chapter 11	Introduction to Classes

11.1	Object Based Programming 						380

11.2	Classes									384
	Class Construction							385
	Terminology								392

11.3	Constructors								394
	Calling Constructors							397
	Overloaded and Inline Constructors					397
	Destructors								401
	Arrays of Objects							401

11.4	An Application								404

11.5	Common Programming Errors						409

11.6	Chapter Summary								410



Chapter 12	Additional Class Capabilities

12.1	Assignment								414
	Copy Constructors							418
	Base/Member Initialization						421

12.2	Pointers as Class Members						422
	Assignment Operators and Copy Constructors Reconsidered			428

12.3	Additional Class Features						431
	Class Scope								431
	Static Class Members							432
	The this Pointer							436
	Friend Functions							439

12.4	Common Programming Errors						443

12.5	Chapter Summary								444


Chapter 13	Class Functions, Conversions and Inheritance

13.1	Operator Functions							448
	Operator Functions as Friends						456
	The Assignment Operator Revisted					457

13.2	Two Useful Alternatives operator() and operator[]			461

13.3	Data Type Conversions							465
	Built-In to Built-In Conversion						465
	Built-In to Class Conversion						466
	Class to Built-In Conversions						468
	Class to Class Conversion						470

13.4	Class Inheritance							473
	Inheritance 								474
	Access Specifictations							475
	An Example								476
	Polymorphism								480

13.5	Common Programming Errors						485

13.6	Chapter Summary								486


Chapter 14	Data Files

14.1	Declaring, Opening, and Closing Files					490
	Opening a File								491
	Closing a File								495

14.2	Reading and Writing Files						496
	Standard Device Files							501
	Other Devices								501

14.3	Random File Access							504

14.4	Passing and Returning File Names					507

14.5	Common Programming Errors						511

14.6	Chapter Summary								511

14.7	Chapter Appendix- The iostream Library					513
	File Stream Transfer Mechanism						513
	Components of the iostreawm Library					514
	In-Memory Formatting							516


Chapter 15	bit Operations

15.1	The AND Operator							520

15.2	The Inclusive OR Operator						523

15.3	The Exclusive OR Operator						526

15.4	The Complement Operator							527

15.5	Different-Size Data Items						528

15.6	The Shfit Operators							530

15.7	Chapter Summary								533


Appendixes
A.	Operator Precedence Table						536
B.	ASCII Character Codes							537
C.	Program Entry, Compilation, and execution under the DOS,
	UNIZ, VAX-VMS, and PRIME Operating Systems				538
D.	Input, Output, and Standard Error Redirection				545
E.	Common Line Artuments							548
F.	Floating Point Number Storage						552
G.	Linked Lists Using Classes						555
H.	Solutions								565

INDEX										645