Related Products

Starting Out with C++ From Control Structures through Objects, Brief Edition

Starting Out with C++ From Control Structures through Objects, Brief Edition plus MyProgrammingLab with Pearson eText - Access Card Package

Starting Out with C++ from Control Structures through Objects, Brief Version

Starting Out With C++ Brief

Starting Out with C++ from Control Structures through Objects, Brief Version plus MyProgrammingLab with Pearson eText -- Access Card Package

Starting Out With C++: Brief

Brief Version of Starting Out With C++

Summary

Starting Out with C++ teaches C++ from the ground up, and assumes no prior background in programming. In Starting Out With C++, Gaddis makes a very detailed and slow-paced presentation of both programming and C++ syntax concepts so all readers will be able to follow along. Objects are introduced after control structures, functions, arrays, and pointers, and C-style strings are used throughout. This book is designed for readers without prior programming experience, and is also appropriate for those with knowledge of other languages who want to learn the C++ programming language.

Table of Contents

Preface

ix

Introduction to Computers and Programming

1

(26)

Why Program?

1

(1)

Computer Systems: Hardware and Software

2

(4)

Programs and Programming Languages

6

(6)

What Is a Program Made of?

12

(4)

Input, Processing, and Output

16

(1)

The Programming Process

17

(4)

Procedural and Object-Oriented Programming

21

(6)

Introduction to C++

27

(50)

The Parts of a C++ Program

27

(4)

The cout Object

31

(4)

The #include Directive

35

(2)

Variables and Literals

37

(3)

Identifiers

40

(2)

Integer Data Types

42

(4)

The char Data Type

46

(5)

Floating-Point Data Types

51

(4)

The bool Data Type

55

(1)

Determining the Size of a Data Type

56

(1)

Variable Assignments and Initialization

57

(1)

Scope

58

(1)

Arithmetic Operators

59

(4)

Comments

63

(2)

Focus on Software Engineering: Programming Style

65

(2)

If You Plan to Continue in Computer Science: Standard and Prestandard C++

67

(10)

Expressions and Interactivity

77

(80)

The cin Object

77

(8)

Mathematical Expressions

85

(8)

When You Mix Apples and Oranges: Type Conversion

93

(2)

Overflow and Underflow

95

(1)

Type Casting

96

(4)

Named Constants

100

(5)

Multiple Assignment and Combined Assignment

105

(4)

Formatting Output

109

(10)

Formatted Input

119

(5)

Focus on Object-Oriented Programming: More About Member Functions

124

(1)

More Mathematical Library Functions

124

(4)

Focus on Debugging: Hand Tracing a Program

128

(2)

Focus on Problem Solving: A Case Study

130

(4)

Introduction to File Input and Output

134

(23)

Making Decisions

157

(82)

Relational Operators

157

(5)

The if Statement

162

(8)

Flags

170

(1)

Expanding the if Statement

171

(4)

The if/else Statement

175

(3)

The if/else if Statement

178

(5)

Using a Trailing else

183

(1)

Menus

184

(2)

Focus on Software Engineering: Nested if Statements

186

(6)

Logical Operators

192

(6)

Checking Numeric Ranges with Logical Operators

198

(2)

Focus on Software Engineering: Validating User Input

200

(2)

More About Variable Definitions and Scope

202

(4)

Comparing Strings

206

(5)

The Conditional Operator

211

(4)

The switch Statement

215

(9)

Testing for File Open Errors

224

(15)

Looping

239

(52)

The Increment and Decrement Operators

239

(5)

Introduction to Loops: The while Loop

244

(5)

Using the while Loop for Input Validation

249

(3)

Counters

252

(1)

The do-while Loop

253

(5)

The for Loop

258

(9)

Keeping a Running Total

267

(1)

Sentinels

268

(2)

Using a Loop to Read Data from a File

270

(3)

Focus on Software Engineering: Deciding Which Loop to Use

273

(1)

Nested Loops

273

(3)

Breaking Out of a Loop

276

(2)

The continue Statement

278

(13)

Functions

291

(74)

Focus on Software Engineering: Modular Programming

291

(2)

Defining and Calling Functions

293

(8)

Function Prototypes

301

(2)

Sending Data into a Function

303

(5)

Passing Data by Value

308

(2)

Focus on Software Engineering: Using Functions in a Menu-Driven Program

310

(4)

The return Statement

314

(2)

Returning a Value from a Function

316

(6)

Returning a Boolean Value

322

(2)

Local and Global Variables

324

(7)

Static Local Variables

331

(4)

Default Arguments

335

(4)

Using Reference Variables as Parameters

339

(5)

Overloading Functions

344

(5)

The exit () Function

349

(2)

Stubs and Drivers

351

(14)

Arrays

365

(76)

Arrays Hold Multiple Values

365

(2)

Accessing Array Elements

367

(7)

No Bounds Checking in C++

374

(3)

Array Initialization

377

(5)

Processing Array Contents

382

(8)

Focus on Software Engineering: Using Parallel Arrays

390

(3)

Arrays as Function Arguments

393

(10)

Two-Dimensional Arrays

403

(7)

Arrays of Strings

410

(2)

Arrays with Three or More Dimensions

412

(2)

Focus on Problem Solving and Program Design: A Case Study

414

(2)

If You Plan to Continue in Computer Science: Introduction to the STL vector