Menu Expand
Starting Out with C++ from Control Structures through Objects, Brief Version, Global Edition

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

Tony Gaddis

(2016)

Additional Information

Book Details

Abstract

For introductory courses in computer programming

 

A Problem-Solving Approach to Programming

In Starting Out with C++: From Control Structures through Objects, Brief Edition, Gaddis takes a problem-solving approach, inspiring students to understand the logic behind developing quality programs while introducing the C++ programming language. This style of teaching builds programming confidence and enhances each student's development of programming skills. This edition in the Starting Out With Series covers the core programming concepts that are introduced in the first semester introductory programming course. As with all Gaddis texts, clear and easy-to-read code listings, concise and practical real-world examples, and an abundance of exercises appear in every chapter. The Eighth Edition is updated and revised to reflect changes to the C++ programming language.

 

Also available with MyProgrammingLab

This title is also available with MyProgrammingLab to help students fully grasp the logic, semantics, and syntax of programming. Through practice exercises and immediate, personalized feedback, MyProgrammingLab improves the programming competence of beginning students who often struggle with the basic concepts and paradigms of popular high-level programming languages.


MyProgrammingLab consists of hundreds of practice exercises organized around the structure of this textbook. For students, the system automatically detects errors in the logic and syntax of their code submissions and offers targeted hints that enable students to figure out what went wrong–and why. For instructors, a comprehensive gradebook tracks students’ submissions and provides educators a dynamic tool for monitoring individual and class performance.

 

MyProgrammingLab not included. Students, if MyProgrammingLab is a recommended/mandatory component of the course, please ask your instructor for the correct ISBN and course ID. MyProgrammingLab should only be purchased when required by an instructor. Instructors, contact your Pearson representative for more information.


MyProgrammingLab is an online homework, tutorial, and assessment product designed to personalize learning and improve results. With a wide range of interactive, engaging, and assignable activities, students are encouraged to actively learn and retain tough course concepts.


Table of Contents

Section Title Page Action Price
Cover Cover
Title Page 3
Copyright Page 4
Supplements 23
Acknowledgments 25
About the Author 28
Contents 7
Preface 15
CHAPTER 1 Introduction to Computers and Programming 31
1.1 Why Program? 31
1.2 Computer Systems: Hardware and Software 32
1.3 Programs and Programming Languages 38
1.4 What Is a Program Made of? 44
1.5 Input, Processing, and Output 47
1.6 The Programming Process 48
1.7 Procedural and Object-Oriented Programming 52
CHAPTER 2 Introduction to C 57
2.1 The Parts of a C++ Program 57
2.2 The cout Object 61
2.3 The 66
2.4 Variables and Literals 67
2.5 Identifiers 71
2.6 Integer Data Types 72
2.7 The char Data Type 78
2.8 The C++ string Class 82
2.9 Floating-Point Data Types 84
2.10 The bool Data Type 87
2.11 Determining the Size of a Data Type 88
2.12 Variable Assignments and Initialization 89
2.13 Scope 91
2.14 Arithmetic Operators 91
2.15 Comments 99
2.16 Named Constants 101
2.17 Programming Style 103
CHAPTER 3 Expressions and Interactivity 113
3.1 The cin Object 113
3.2 Mathematical Expressions 119
3.3 When You Mix Apples and Oranges: Type Conversion 128
3.4 Overflow and Underflow 130
3.5 Type Casting 131
3.6 Multiple Assignment and Combined Assignment 134
3.7 Formatting Output 138
3.8 Working with Characters and string Objects 148
3.9 More Mathematical Library Functions 154
3.10 Focus on Debugging: Hand Tracing a Program 160
3.11 Focus on Problem Solving: A Case Study 162
CHAPTER 4 Making Decisions 179
4.1 Relational Operators 179
4.2 The if Statement 184
4.3 Expanding the if Statement 192
4.4 The if/else Statement 196
4.5 Nested if Statements 199
4.6 The if/else if Statement 206
4.7 Flags 211
4.8 Logical Operators 212
4.9 Checking Numeric Ranges with Logical Operators 219
4.10 Menus 220
4.11 Focus on Software Engineering: Validating User Input 223
4.12 Comparing Characters and Strings 225
4.13 The Conditional Operator 229
4.14 The switch Statement 232
4.15 More About Blocks and Variable Scope 241
CHAPTER 5 Loops and Files 257
5.1 The Increment and Decrement Operators 257
5.2 Introduction to Loops: The while Loop 262
5.3 Using the while Loop for Input Validation 269
5.4 Counters 271
5.5 The do-while Loop 272
5.6 The for Loop 277
5.7 Keeping a Running Total 287
5.8 Sentinels 290
5.9 Focus on Software Engineering: Deciding Which Loop to Use 291
5.10 Nested Loops 292
5.11 Using Files for Data Storage 295
5.12 Optional Topics: Breaking and Continuing a Loop 314
CHAPTER 6 Functions 329
6.1 Focus on Software Engineering: Modular Programming 329
6.2 Defining and Calling Functions 330
6.3 Function Prototypes 339
6.4 Sending Data into a Function 341
6.5 Passing Data by Value 346
6.6 Focus on Software Engineering: Using Functions in a Menu-Driven Program 348
6.7 The return Statement 352
6.8 Returning a Value from a Function 354
6.9 Returning a Boolean Value 362
6.10 Local and Global Variables 364
6.11 Static Local Variables 372
6.12 Default Arguments 375
6.13 Using Reference Variables as Parameters 378
6.14 Overloading Functions 384
6.15 The exit() Function 388
6.16 Stubs and Drivers 391
CHAPTER 7 Arrays 405
7.1 Arrays Hold Multiple Values 405
7.2 Accessing Array Elements 407
7.3 No Bounds Checking in C 414
7.4 Array Initialization 417
7.5 The Range-Based for Loop 422
7.6 Processing Array Contents 426
7.7 Focus on Software Engineering: Using Parallel Arrays 434
7.8 Arrays as Function Arguments 437
7.9 Two-Dimensional Arrays 448
7.10 Arrays with Three or More Dimensions 455
7.11 Focus on Problem Solving and Program Design: A Case Study 457
7.12 If You Plan to Continue in Computer Science: Introduction to the STL vector 459
CHAPTER 8 Searching and Sorting Arrays 487
8.1 Focus on Software Engineering: Introduction to Search Algorithms 487
8.2 Focus on Problem Solving and Program Design: A Case Study 493
8.3 Focus on Software Engineering: Introduction to Sorting Algorithms 500
8.4 Focus on Problem Solving and Program Design: A Case Study 507
8.5 If You Plan to Continue in Computer Science: Sorting and Searching vectors 515
CHAPTER 9 Pointers 525
9.1 Getting the Address of a Variable 525
9.2 Pointer Variables 527
9.3 The Relationship Between Arrays and Pointers 534
9.4 Pointer Arithmetic 538
9.5 Initializing Pointers 540
9.6 Comparing Pointers 541
9.7 Pointers as Function Parameters 543
9.8 Focus on Software Engineering: Dynamic Memory Allocation 552
9.9 Focus on Software Engineering: Returning Pointers from Functions 556
9.10 Using Smart Pointers to Avoid Memory Leaks 563
9.11 Focus on Problem Solving and Program Design: A Case Study 566
CHAPTER 10 Characters, C-Strings, and More About the string Class 577
10.1 Character Testing 577
10.2 Character Case Conversion 581
10.3 C-Strings 584
10.4 Library Functions for Working with C-Strings 588
10.5 C-String/Numeric Conversion Functions 599
10.6 Focus on Software Engineering: Writing Your Own C-String-Handling Functions 605
10.7 More About the C++ string Class 611
10.8 Focus on Problem Solving and Program Design: A Case Study 620
CHAPTER 11 Structured Data 629
11.1 Abstract Data Types 629
11.2 Focus on Software Engineering: Combining Data into Structures 631
11.3 Accessing Structure Members 634
11.4 Initializing a Structure 638
11.5 Arrays of Structures 641
11.6 Focus on Software Engineering: Nested Structures 643
11.7 Structures as Function Arguments 647
11.8 Returning a Structure from a Function 650
11.9 Pointers to Structures 653
11.10 Focus on Software Engineering: When to Use ., When to Use ->, and When to Use * 656
11.11 Unions 658
11.12 Enumerated Data Types 662
CHAPTER 12 Advanced File Operations 687
12.1 File Operations 687
12.2 File Output Formatting 693
12.3 Passing File Stream Objects to Functions 695
12.4 More Detailed Error Testing 697
12.5 Member Functions for Reading and Writing Files 700
12.6 Focus on Software Engineering: Working with Multiple Files 708
12.7 Binary Files 710
12.8 Creating Records with Structures 715
12.9 Random-Access Files 719
12.10 Opening a File for Both Input and Output 727
CHAPTER 13 Introduction to Classes 741
13.1 Procedural and Object-Oriented Programming 741
13.2 Introduction to Classes 748
13.3 Defining an Instance of a Class 753
13.4 Why Have Private Members? 766
13.5 Focus on Software Engineering: Separating Class Specification from Implementation 767
13.6 Inline Member Functions 773
13.7 Constructors 776
13.8 Passing Arguments to Constructors 780
13.9 Destructors 788
13.10 Overloading Constructors 792
13.11 Private Member Functions 795
13.12 Arrays of Objects 797
13.13 Focus on Problem Solving and Program Design: An OOP Case Study 801
13.14 Focus on Object-Oriented Programming: Simulating Dice with Objects 808
13.15 Focus on Object-Oriented Programming: Creating an Abstract Array Data Type 812
13.16 Focus on Object-Oriented Design: The Unified Modeling Language (UML) 815
13.17 Focus on Object-Oriented Design: Finding the Classes and Their Responsibilities 818
CHAPTER 14 More About Classes 841
14.1 Instance and Static Members 841
14.2 Friends of Classes 849
14.3 Memberwise Assignment 854
14.4 Copy Constructors 855
14.5 Operator Overloading 861
14.6 Object Conversion 888
14.7 Aggregation 890
14.8 Focus on Object-Oriented Design: Class Collaborations 895
14.9 Focus on Object-Oriented Programming: Simulating the Game of Cho-Han 899
CHAPTER 15 Inheritance, Polymorphism, and Virtual Functions 921
15.1 What Is Inheritance? 921
15.2 Protected Members and Class Access 930
15.3 Constructors and Destructors in Base and Derived Classes 936
15.4 Redefining Base Class Functions 948
15.5 Class Hierarchies 953
15.6 Polymorphism and Virtual Member Functions 959
15.7 Abstract Base Classes and Pure Virtual Functions 975
15.8 Multiple Inheritance 982
APPENDIX A: Getting Started with Alice 1001
APPENDIX B: The ASCII Character Set 1027
APPENDIX C: Operator Precedence and Associativity 1029
Quick References 1031
Index 1033
A 1033
B 1034
C 1034
D 1037
E 1038
F 1038
G 1040
H 1040
I 1040
J 1041
K 1041
L 1041
M 1042
N 1043
O 1043
P 1044
R 1045
S 1045
T 1047
U 1047
V 1048
W 1048
Z 1048
Credit 1049