Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

Readings from Programming with C++

1st Edition Kyla Mcmullen


Visit to download the full and correct content document:
https://ebookmass.com/product/readings-from-programming-with-c-1st-edition-kyla-m
cmullen-2/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Readings from Programming with C++ 1st Edition Kyla


Mcmullen

https://ebookmass.com/product/readings-from-programming-
with-c-1st-edition-kyla-mcmullen-2/

Programming With STM32: Getting Started With the Nucleo


Board and C/C++ Donald Norris

https://ebookmass.com/product/programming-with-stm32-getting-
started-with-the-nucleo-board-and-c-c-donald-norris/

Artificial Intelligence Programming with Python from


Zero to Hero 1st Edition Perry Xiao

https://ebookmass.com/product/artificial-intelligence-
programming-with-python-from-zero-to-hero-1st-edition-perry-xiao/

C Programming Language: C PROGRAMMING LANG _p2 2nd


Edition, (Ebook PDF)

https://ebookmass.com/product/c-programming-language-c-
programming-lang-_p2-2nd-edition-ebook-pdf/
Learn Programming with C: An Easy Step-by-Step Self-
Practice Book for Learning C 1st Edition Imran

https://ebookmass.com/product/learn-programming-with-c-an-easy-
step-by-step-self-practice-book-for-learning-c-1st-edition-imran/

C++ Programming: From Problem Analysis to Program


Design 8th Edition Edition D.S. Malik

https://ebookmass.com/product/c-programming-from-problem-
analysis-to-program-design-8th-edition-edition-d-s-malik/

Everyone’s an Author with Readings (Second Edition)

https://ebookmass.com/product/everyones-an-author-with-readings-
second-edition/

eTextbook 978-1285856872 C# Programming: From Problem


Analysis to Program Design

https://ebookmass.com/product/etextbook-978-1285856872-c-
programming-from-problem-analysis-to-program-design/

Everythingu2019s an Argument with Readings 8th Edition


eBook

https://ebookmass.com/product/everythings-an-argument-with-
readings-8th-edition-ebook/
Programming with

C++ KYLA McMULLEN


Elizabeth matthews
June Jamrich Parsons

Australia • Brazil • Canada • Mexico • Singapore • United Kingdom • United States

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
This is an electronic version of the print textbook. Due to electronic rights restrictions,
some third party content may be suppressed. Editorial review has deemed that any suppressed
content does not materially affect the overall learning experience. The publisher reserves the right
to remove content from this title at any time if subsequent rights restrictions require it. For
valuable information on pricing, previous editions, changes to current editions, and alternate
formats, please visit www.cengage.com/highered to search by ISBN#, author, title, or keyword for
materials in your areas of interest.

Important Notice: Media content referenced within the product description or the product
text may not be available in the eBook version.

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Readings from Programming with C++ © 2022 Cengage Learning, Inc.
Kyla McMullen, Elizabeth Matthews, WCN: 02-300
June Jamrich Parsons
Unless otherwise noted, all content is © Cengage.
SVP, Higher Education Product Management:
ALL RIGHTS RESERVED. No part of this work covered by the copyright herein
Erin Joyner
may be reproduced or distributed in any form or by any means, except as
VP, Product Management: Thais Alencar permitted by U.S. copyright law, without the prior written permission of the
copyright owner.
Product Team Manager: Kristin McNary

Associate Product Manager: Tran Pham For product information and technology assistance, contact us at
Cengage Customer & Sales Support, 1-800-354-9706
Product Assistant: Tom Benedetto
or support.cengage.com.
Learning Designer: Mary Convertino

Senior Content Manager: Maria Garguilo For permission to use material from this text or product, submit all requests
online at www.cengage.com/permissions.
Digital Delivery Lead: David O’Connor

Technical Editor: John Freitas Library of Congress Control Number: 2020922802

Developmental Editor: Lisa Ruffolo ISBN: 978-0-357-63775-3

Vice President, Marketing – Science, Technology,


Cengage
& Math: Jason Sakos
200 Pier 4 Boulevard
Senior Director, Marketing: Michele McTighe Boston, MA 02210
USA
Marketing Manager: Cassie L. Cloutier

Marketing Development Manager: Cengage is a leading provider of customized learning solutions with
Samantha Best employees residing in nearly 40 different countries and sales in more than
125 countries around the world. Find your local representative at
Product Specialist: Mackenzie Paine
www.cengage.com.
IP Analyst: Ashley Maynard
To learn more about Cengage platforms and services, register or access
IP Project Manager: Cassidie Parker your online learning solution, or purchase materials for your course, visit
www.cengage.com.
Production Service: SPi Global
Notice to the Reader
Designer: Erin Griffin Publisher does not warrant or guarantee any of the products described

Cover Image Source: echo3005/ShutterStock.com herein or perform any independent analysis in connection with any of the
product information contained herein. Publisher does not assume, and
expressly disclaims, any obligation to obtain and include information other
than that provided to it by the manufacturer. The reader is expressly warned
to consider and adopt all safety precautions that might be indicated by the
activities described herein and to avoid all potential hazards. By following
the instructions contained herein, the reader willingly assumes all risks in
connection with such instructions. The publisher makes no representations or
warranties of any kind, including but not limited to, the warranties of fitness
for particular purpose or merchantability, nor are any such representations
implied with respect to the material set forth herein, and the publisher takes
no responsibility with respect to such material. The publisher shall not be
liable for any special, consequential, or exemplary damages resulting, in
whole or part, from the readers’ use of, or reliance upon, this material.

Printed in Mexico
Print Number: 01 Print Year: 2020

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Brief Contents

prefacexiii Module 17
Polymorphism 309
Module 1
Computational Thinking 1 Module 18
Templates 319
Module 2
Programming Tools 15 Module 19
Linked List Data Structures 333
Module 3
Literals, Variables, and Constants 35 Module 20
Stacks and Queues 353
Module 4
Numeric Data Types and Expressions 49 Module 21
Trees and Graphs 371
Module 5
Character and String Data Types 63 Module 22
Algorithm Complexity and Big-O Notation 395
Module 6
Decision Control Structures 83 Module 23
Search Algorithms 411
Module 7
Repetition Control Structures 103 Module 24
Sorting Algorithms 427
Module 8
Arrays 125 Module 25
Processor Architecture 455
Module 9
Functions 145 Module 26
Data Representation 469
Module 10
Recursion 165 Module 27
Programming Paradigms 491
Module 11
Exceptions 185 Module 28
User Interfaces 507
Module 12
File Operations 205 Module 29
Software Development Methodologies 525
Module 13
Classes and Objects 231 Module 30
Pseudocode, Flowcharts, and Decision Tables 541
Module 14
Methods 245 Module 31
Unified Modeling Language 557
Module 15
Encapsulation 271
GLOSSARY 569
Module 16 Index 583
Inheritance 291

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents

prefacexiii Build Tools 22


The Toolset 22
Module 1 Compilers 23
COMPUTATIONAL THINKING 1 Preprocessors and Linkers 24
Virtual Machines 25
Algorithms2 Interpreters 26
Algorithm Basics 2 Debugging Tools 27
Programming Algorithms 2 Programming Errors 27
“Good” Algorithms 3 Syntax Errors 28
Selecting and Creating Algorithms 4 Runtime Errors 29
Decomposition4 Semantic Errors 29
Decomposition Basics 4 Debugging Utilities 30
Structural Decomposition 5 IDEs and SDKs 32
Functional Decomposition 6 Integrated Development Environments 32
Object-Oriented Decomposition 7 Software Development Kits 32
Dependencies and Cohesion 7
Summary 33
Pattern Identification 8
Key Terms  34
Pattern Identification Basics 8
Repetitive Patterns 8
Module 3
Classification Patterns 9
Abstraction9 LITERALS, VARIABLES, AND
Abstraction Basics 9 CONSTANTS35
Classes and Objects 10
Literals36
Black Boxes 11
Numeric Literals 36
Levels of Abstraction 12
Character and String Literals 37
Summary12 Tricky Literals 38
Key Terms  13 Variables and Constants 38
Variables 38
Module 2 Constants 40
PROGRAMMING TOOLS 15 The Memory Connection 41
Assignment Statements 41
Programming Languages 16 Declaring Variables  41
Hello World! 16 Initializing Variables 42
Programming Language Basics 16 Assigning Variables 43
Syntax and Semantics 17
Input and Output 44
Core Elements 19
Your Toolbox 19 Input to a Variable  44
Output from a Variable 46
Coding Tools 20
Program Editors 20 Summary 46
Basic Structure 21 Key Terms  47

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents v

Module 4 Module 6
Numeric Data Types and Decision Control
Expressions 49 Structures 83
Primitive Data Types 50 If-Then Control Structures 84
Data Types 50 Control Structures 84
Primitive Data Types 50 Decision Logic 85
Composite Data Types 51 If-Then Structures 85
Numeric Data Types 52 Relational Operators 87
Integer Data Types 52 The Equal Operator 87
Floating-Point Data Types 53 Using Relational Operators 88
Mathematical Expressions 54 Boolean Expressions and Data Types 89
Arithmetic Operators 54 Multiple Conditions 91
Order of Operations 56 If-Then-Else Structures 91
Compound Operators 56 Nested-If Structures 93
Numeric Data Type Conversion 58 Else If Structures 96
Convert Integers and Floating-Point Numbers 58 Fall Through 97
Rounding Quirks 59 Conditional Logical Operators 100
Formatting Output 60 The AND Operator 100
Formatted Output 60 The OR Operator 101
Formatting Parameters 60 Summary 102
Summary 62 Key Terms 102
Key Terms 62

Module 7
Module 5 Repetition Control
CHARACTER AND STRING DATA TYPES 63 Structures 103
Character Data Types 64 Count-Controlled Loops 104
Working with Character Data 64 Loop Basics 104
Character Memory Allocation 65 Control Statements 105
Digits 66 For-Loops 105
Character Output Format 67 User-Controlled Loops 108
Character Manipulation 68
Counters and Accumulators 109
String Data Types 69 Loops That Count 109
Working with String Data 69 Loops That Accumulate 111
Escape Characters 70
String Indexes 71
Nested Loops 112
Loops Within Loops 112
String Functions 72
Inner and Outer Loops 113
String Manipulation 72
String Length 72 Pre-Test Loops 116
Change Case 73 While-Loops 116
Find the Location of a Character 74 Infinite Loops 117
Retrieve a Substring 75 Breaking Out of Loops 118
Concatenation and Typecasting 76 Post-Test Loops 120
Concatenated Output 76 Do-Loops 120
Concatenated Variables 77 Test Conditions and Terminating
Coercion and Typecasting 78 Conditions 123
Summary 80 Summary 124
Key Terms 81 Key Terms 124

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
vi Programming with C++

Module 8 Pass by Reference 161


Namespaces 162
Arrays 125
Summary 163
Array Basics 126
Key Terms 163
Magic Rectangles 126
Array Characteristics 127
Array Use Cases 128 Module 10
One-Dimensional Arrays 128 Recursion 165
Initialize Numeric Arrays 128
Key Components of Recursion 165
Initialize String Arrays 130
The Recursive Mindset 165
Array Input and Output 130 Recursion Basics 167
Output an Array Element 130 When to Use Recursion 171
Index Errors 131
Using Recursion to Solve Complex
Traverse an Array 132
Problems 171
Input Array Elements 133
Designing Recursive Structures 171
Array Operations 135 Linear Recursion 174
Change an Array Element 135 Branching Recursion 175
Find an Array Element 135
Managing Memory during Recursion 179
Sum Array Elements 137
Memory Management 179
Two-Dimensional Arrays 137 Stable Recursion 182
Two-Dimensional Array Basics 137
Summary 183
Initialize a Two-Dimensional Array 138
Output a Two-Dimensional Array 139 Key Terms 183
Sum Array Columns and Rows 141
Summary 143 Module 11
Key Terms 144 Exceptions 185
Defining Exceptions 185
Module 9 Errors in Code 185
Functions 145 Exception Types 187

Function Basics 146 Dealing with Exceptions 189


Function Classifications 146 Handling Others’ Exceptions 189
Programmer-Defined Functions 146 Try and Catch Blocks 189
Flow of Execution 147 Using Exceptions 198
Function Advantages 147 Throwing Exceptions 198
Void Functions 148 When to Bail 202
Void Function Basics 148 Summary 203
Function Pseudocode 149
Key Terms 203
Functions with Parameters 150
Function Parameters 150
Module 12
Function Arguments 150
The Handoff 152 File Operations 205
Return Values 153 File Input and Output 206
Return Values 153 The Purpose of Files 206
Return Type 156 Anatomy of a File 210
Function Signature 157 File Usage 212
Scope 157 Processing a File 214
Scope Basics 157 Accessing Files 214
Pass by Value 160 Streaming and Buffering 214

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents vii

Reading from a File 216 Method Cascading and Method Chaining 263
Opening a File for Reading 216 Calling Multiple Methods on the Same Object 263
Reading from a File 218 Using Constructors 266
Closing a File 222 Specifying How to Construct an Object 266
Closing Files after Use 222 Constructing an Object from Another Object 268
Trying to Close a File 222 Summary 269
Creating and Writing New Files 222
Key Terms 269
Creating a File 222
Opening a File for Writing 223 Module 15
Writing to and Appending a File 224
Anticipating Exceptions 228 Encapsulation 271
Summary 229 Components of Class Structure 271
Key Terms 230 Data Hiding 271
Designing Objects 273
Self-Reference Scope 276
Module 13 Accessor and Mutator Context 277
Classes and Objects 231 Viewing Data from an Object 277
Classes in Object-Oriented Programming 232 Changing Data in an Object 278
Representing the Real World with Code 232 Using Constructors 280
Using Classes 232 Parameters and Arguments 280
Class Components 233 Default Parameters and Constructor
Using Objects 236 Overloading 281
Creating Objects 236 Encapsulation Enforcement
Objects as Variables 238 with Access Modifiers 283
Object-Oriented Features and Principles 238 Access Modifiers 283
Using Static Elements in a Class 239 Public Variables and Methods 283
Private Variables and Methods 284
Static Member Variables 239
Static Methods 240 Interfaces and Headers 286
Static Classes 241 Interfaces 286
Characteristics of Objects Programming an Interface 287
in Object-Oriented Programs 242 Summary 290
Object Identity 242 Key Terms 290
Object State 242
Object Behavior 243 Module 16
Summary 244 Inheritance 291
Key Terms 244 Using Inheritance 291
Creating Classes from Other Classes 291
Module 14 Family Trees in OOP 292
Methods 245 Levels of Access 295
Necessary Components for Inheritance 296
Using Methods 245
Defining a Parent Class 296
Why Use Methods? 245 Defining a Child Class 297
Anatomy of a Method 251
Creating a Child Class That Inherits
Using Methods 251
from a Parent Class 298
Changing the Default Behavior
Inheritance Syntax 298
of an Object 255 Customizing Behavior 301
Using Objects as Regular Variables 255
Overloading Methods 258 Summary 307
Setting One Object to Equal Another 262 Key Terms 307

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
viii Programming with C++

Module 17 The Find Method 346


The Insert Method 347
Polymorphism 309
Summary 350
The Purpose of Polymorphism 309
Key Terms 351
Flexibility While Coding 309
Dynamic Binding Under the Hood 314
Polymorphism Basics 314 Module 20
Classes Within Classes 314 Stacks and Queues 353
Objects as Other Objects 315 Stacks 353
Virtual Functions 316 Stack Basics 353
Anticipating Customization 316 Stack Use Cases 355
Abstract Classes 317 Built-in Stacks 356
Summary 318 Code a Stack 357

Key Terms 318


Queues 362
Queue Basics 362
Module 18 Queue Use Cases 363
Code a Queue 364
Templates 319
Summary 369
Template Basics 319
Key Terms 369
Data Abstraction 319
Template Structure and Use 322
Module 21
Tricky Templating 328
Advanced Templating 328
Trees and Graphs 371
Templated Objects as Arguments 330 Nonlinear Data Structures 371
Templates as a Problem-Solving Linear versus Nonlinear Structures 371
Approach 331 Nonlinear Building Blocks 373
Designing a Template 331 Tree Structures 373
When to Use Templates 331 Tree Basics 373
Summary 331 Tree Properties 376
Trees as Recursive Structures 376
Key Terms 332
Solving Problems Using Trees 379
Module 19 Tree Applications 379
Linked List Data Data Storage in Trees 380
Graph Structures 387
Structures 333
Graph Basics 387
Linked List Structures 334 Directed and Undirected Graphs 388
Data Structure Selection 334 Solving Problems with Graphs 388
Data Structure Implementation 335 Graph Applications 388
Linked List Basics 336 Computing Paths 389
Types of Linked Lists 337
Summary 394
Singly Linked Lists 337
Doubly Linked Lists 338 Key Terms 394
Circular Linked Lists 339
Linked List Characteristics 339 Module 22
Code a Linked List 342 Algorithm Complexity
The Node Class 342 and Big-O Notation 395
The LinkedList Class 343
The Append Method 343 Big-O Notation 396
Linked List Traversal 345 Algorithm Complexity 396

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents ix

Asymptotic Analysis 397 Quicksort 438


Asymptotic Notation 398 Defining the Quicksort Algorithm 438
Time Complexity 398 Quicksort Properties 446
Big-O Metrics 398 Merge Sort 447
Constant Time 399 Defining the Merge Sort Algorithm 447
Linear Time 399 Merge Sort Properties 453
Quadratic Time 400
Summary 454
Logarithmic Time 401
Key Terms 454
Space Complexity 403
Memory Space 403 Module 25
Constant Space Complexity 404
Linear Space Complexity 404 Processor Architecture 455
Complexity Calculations 405 Processor Organization 456
Line-by-Line Time Complexity 405 Integrated Circuits 456
Combine and Simplify 406 Moore’s Law 458
A Mystery Algorithm 407 CPUs 458
Low-Level Instruction Sets 459
Summary 409
Microprocessor Instruction Sets 459
Key Terms 409 RISC and CISC 460
Machine Language 460
Module 23 Assembly Language 461

Search Algorithms 411 Microprocessor Operations 462


Processing an Instruction 462
Using Search Algorithms 412 The Instruction Cycle 462
Search Basics 412 High-Level Programming Languages 464
Performing a Linear Search 413 Evolution 464
Looking for a Needle in a Haystack 413 Teaching Languages 465
Evaluating Search Time 416 The C Family 465
Web Programming Languages 466
Performing a Binary Search 416 Characteristics 466
Shrinking the Search Space 416 Advantages and Disadvantages 467
Implementing Binary Search 418
Summary 467
Using Regular Expressions
Key Terms 468
in Search Algorithms 423
Specifying a Search Pattern 423 Module 26
Regular Expression Search Operators 423
Data Representation 469
Summary 426
Bits and Bytes 470
Key Terms 426
Digital Data 470
Bits 471
Module 24 Bytes 472
Sorting Algorithms 427 Binary 474
Binary Numbers 474
Qualities of Sorting Algorithms 428 Binary to Decimal 475
Ordering Items 428 Decimal to Binary 476
Time Complexity in Sorting Algorithms 428 Binary Addition 477
Sorting Properties 430 Negative Numbers 478
Bubble Sort 431 Hexadecimal 480
Defining the Bubble Sort Algorithm 431 Colors 480
Bubble Sort Properties 437 Hexadecimal Numbers 481

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
x Programming with C++

Binary-Hex-Binary Conversions 481 Speech Synthesis 516


Hex-Decimal Conversion 482 Designing Programs for Voice User Interfaces 517
Information Density 483 Virtual Environment Interfaces 517
ASCII and Unicode 483 Virtual Environments 517
ASCII 483 Virtual Environment Interface Components 518
Extended ASCII 484 Programming the Virtual Interface 519
Unicode 485 Accessibility and Inclusion 520
Memory Allocation 486 Accessibility Guidelines 520
Memory and Storage 486 Inclusive Design 521
Storage Devices 487 Summary 524
Memory 487
Key Terms 524
Summary 489
Key Terms 489
Module 29
Software Development
Module 27
Methodologies 525
Programming Paradigms 491
Software Development 526
Imperative and Declarative Paradigms 492
The Software Development Life Cycle 526
Think Outside the Box 492
Efficiency, Quality, and Security 527
The Procedural Paradigm 493 The Waterfall Model 528
Procedural Basics 493
Structured Analysis and Design 528
Characteristics of Procedural Programs 494
Waterfall Advantages and Disadvantages 529
Procedural Paradigm Applications 496
The Agile Model 530
The Object-Oriented Paradigm 497
Incremental Development 530
Objects, Classes, and Methods 497
Agile Methodologies 530
Characteristics of Object-Oriented Programs 499
Agile Advantages and Disadvantages 531
Object-Oriented Applications 501
Coding Principles 532
Declarative Paradigms 501
Efficient Coding 532
Declarative Basics 501
Modularized Code 533
Characteristics of the Declarative
Clean Coding 534
Paradigm 504
Secure Coding 534
Applications for Declarative Paradigms 504
Success Factors 536
Summary 505 Testing 536
Key Terms 505 Levels of Testing 536
Unit Testing 537
Module 28 Integration Testing 538
System Testing 539
User Interfaces 507 Acceptance Testing 539
User Interface Basics 508 Regression Testing 539
UI and UX 508 Summary 540
UI Components 508
Key Terms 540
Selecting a UI 510
Command-Line User Interfaces 510
Module 30
Command-Line Basics 510
Command-Line Program Design 510 Pseudocode, Flowcharts,
Graphical User Interfaces 512 and Decision Tables 541
GUI Basics 512 Pseudocode 542
GUI Program Design 514
From Algorithms to Pseudocode 542
Voice User Interfaces 515 Pseudocode Basics 544
Voice Interface Basics 515 Pseudocode Guidelines 545
Speech Recognition 515 Writing Pseudocode 547

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents xi

Flowcharts 548 UML Diagram Parts 558


Flowchart Basics 548 Class Diagram Basics 558
Drawing Flowcharts 548 Use Case Diagram Basics 559
Flowchart Tools 549 Sequence Diagrams 561
Decision Tables 551 Using UML to Structure Programs 562
Decision Table Basics 551 UML Associations 562
List the Conditions 551 Translating UML to Code 564
List All Possible Alternatives 552 Summary 568
Specify Results and Rules 552
Interpret Rules 553 Key Terms 568
Optimize the Rules 554
Check for Completeness and Accuracy 555
GLOSSARY 569
Summary 555
index 583
Key Terms 556

Module 31
Unified Modeling Language 557
Purpose of Unified Modeling
Language (UML) 557
Communicating Ideas to Other Programmers 557

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface

Welcome to Readings from Programming with C11.


This text includes the stand-alone lessons and read-
C11 Version
ings from MindTap for Programming with C11 and is We recommend downloading the latest version of
intended to be used in conjunction with the MindTap C11 before beginning this text. C1114 was used to
Reader for a complete learning experience. test all C11 code presented in the module figures.

MindTap Overview MindTap Features


Programming with C 11 presents conceptual, lan- In addition to the readings included within this text,
guage-agnostic narrative with language-specific assets, the MindTap includes the following:
ungraded C11 coding Snippets, language-agnostic test Course Orientation: Custom videos and readings pre-
banks, and additional instructor resources. The goal of pare students for the material and coding experiences
this digital product is to develop content around the they will encounter in their course.
concepts that are essential for understanding Com-
Videos: Animated videos demonstrate new program-
puter Science from a language-agnostic perspective.
ming terms and concepts in an easy-to-understand for-
Learners will gain a foundational understanding of
mat, increasing student confidence and learning.
procedural programming, computer science concepts,
and object-oriented programming. Instructors have Coding Snippets: These short, ungraded coding activities
identified the need for language-agnostic, conceptual are embedded within the MindTap Reader and provide
content that can be paired with hands-on practice in students an opportunity to practice new programming
a specific language. This 31-module text is designed to concepts “in-the-moment.” Additional language-specific
provide that conceptual content paired with language- “bridge content” helps transition the student from con-
specific examples and hands-on learning activities in ceptual understanding to application of C11 code.
C11. Language-specific Examples: Figures within the nar-
rative illustrate the application of general concepts in
C11 code.
Course Objectives:
• Develop a foundational knowledge of
coding principles, vocabulary, and core Instructor & Student Resources
concepts. Additional instructor and student resources for
• Use new foundational knowledge to this product are available online. Instructor assets
learn C11 programming skills. include an Instructor’s Manual, Teaching Online
• Practice emerging coding skills in a low- Guide, ­PowerPoint® slides, and a test bank powered
risk environment. by ­Cognero®. Student assets include source code
• Apply learned concepts and skills to files and coding Snippets ReadMe. Sign up or sign in
assignments/activities that mimic real- at www.cengage.com to search for and access this
world experiences and environments. product and its online resources.

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
About the Authors

Dr. Kyla McMullen is a tenure-track faculty member published research in the areas of procedural genera-
in the University of Florida’s Computer & Information tion, video game enjoyment factors, and freshwater
Sciences & Engineering Department, specializing in algae identification with HCI.
Human-Centered Computing. Her research interests June Jamrich Parsons is an educator, digital book
are in the perception, applications, and development pioneer, and co-author of Texty and McGuffey Award-
of 3D audio technologies. Dr. McMullen has authored winning textbooks. She co-developed the first com-
over 30 manuscripts in this line of research and is the mercially successful multimedia, interactive digital
primary investigator for over 2 million dollars’ worth textbook; one that set the bar for platforms now
of sponsored research projects. being developed by educational publishers. Her
Dr. Elizabeth A. Matthews is an Assistant Professor of career includes extensive classroom teaching, prod-
Computer Science at Washington and Lee University. uct design for eCourseware, textbook authoring for
She has taught computer science since 2013 and has Course Technology and Cengage, Creative Strategist
been an active researcher in human–computer inter- for MediaTechnics Corporation, and Director of Con-
action and human-centered computing. Matthews has tent for Veative Virtual Reality Labs.

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Acknowledgments

The unique approach for this book required a ­seasoned friends who help me to remain sane, remind me of who
team. Our thanks to Maria Garguilo who ushered the I am, and never let me forget whose I am.
manuscripts through every iteration and kept tight Elizabeth Matthews: I want to thank my parents,
rein on the schedule; to Mary E. Convertino who sup- Drs. Geoff and Robin Matthews, for their support and
plied her expertise in learning design; to Lisa R
­ uffolo understanding in my journey. I would also like to thank
for her excellent developmental edit; to Courtney my advisor, Dr. Juan Gilbert, for seeing my dream to
Cozzy who coordinated the project; to Kristin McNary the end. Finally, I would like to thank my cats, Oreo
for her leadership in Cengage’s computing materials; and Laptop, who made sure that writing this book was
to Rajiv Malkan (Lone Star College) for his instruc- interrupted as often as possible.
tional input; to Wade Schofield (Liberty University) June Jamrich Parsons: Computer programming can
for his reviewing expertise; and to John Freitas for his be a truly satisfying experience. The reward when a
meticulous code review. It was a pleasure to be part program runs flawlessly has to bring a smile even
of this professional and talented team. We hope that to the most seasoned programmers. Working with
instructors and students will appreciate our efforts three programming languages for this project at the
to provide this unique approach to computer science same time was certainly challenging but provided
and programming. insights that can help students understand com-
Kyla McMullen: Above all things, I would like to thank putational thinking. I’ve thoroughly enjoyed work-
God for giving me the gifts and talents that were uti- ing with the team to create these versatile learning
lized to write this book. I would like to thank my amaz- resources and would like to dedicate my efforts to
ing husband Ade Kumuyi for always being my rock, my mom, who has been a steadfast cheerleader for
sounding board, and biggest cheerleader. I thank my me throughout my career. To the instructors and stu-
parents, Rita and James McMullen for all of their sacri- dents who use this book, my hope is that you enjoy
fices to raise me. Last but not least, I thank my spirited programming as much as I do.

Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Another random document with
no related content on Scribd:
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back

You might also like