Home Page Icon
Home Page
Table of Contents for
Exercises, Second Set
Close
Exercises, Second Set
by Steve Heller
C++: A Dialog Programming with the C++ Standard Library
Copyright
List of Figures
Foreword
Preface
Acknowledgments
Letter from a Novice
Introduction to Programming
Definitions
Baby Steps
Hardware Fundamentals
Definitions
Objectives of This Chapter
Inside the Box
The Binary Number System
Exercises
Using the 16-bit Register Names
Review
Conclusion
Answers to Exercises
Basics of Programming
Definitions
Objectives of This Chapter
Rapid and Accurate Calculation
The Compiler
How the CPU Stores and Manipulates Data in Memory
The Layout of Data in Memory
Exercises, First Set
The char and string Types
using, namespace, and std
int main()
Exercises, Second Set
Input and Output
Changing the Course of Execution
The while Loop
Exercises, Third Set
Our First Slightly Realistic Program
Exercises, Fourth Set
Review
Conclusion
Answers to Exercises
More Basics
Objectives of This Chapter
Algorithmic Thinking
Handling Any Number of Prizes
Index Variables
The Selection Sort
Program Failure
Review
Exercises
Conclusion
Answers to Exercises
Functional Literacy
Definitions
Objectives of This Chapter
Modules vs. Functions
Using a Function
Software Is a Virtual Computer
Scope of Variables
The Disadvantages of Global Variables
More on Using the Stack
Review
Exercises
Conclusion
Answers to Exercises
Taking Inventory
Definitions
Objectives of This Chapter
User-defined Data Types
The StockItem class
More Definitions
Concrete Data Types
The class Scope
More about the StockItem class Interface
Working around the Standard Library
Reference Arguments
Checking Inventory for a Misplaced Item
Review
Exercises
Conclusion
Answers to Exercises
Creating a Homegrown string class
Objectives of This Chapter
C String Literals vs. strings
Dynamic Memory Allocation via new and delete
Constructing a string from a C String
Assignment Operator Issues
Solving the Assignment Operator Problem
The const Modifier for Reference Arguments
Calling operator=
Review
Exercises
Conclusion
Answers to Exercises
Finishing Our homegrown string class
Objectives of This Chapter
The string Copy Constructor
More about the private Access Specifier
First Review
Adding Further Facilities to our string class
Initialization vs. Assignment
Second Review
Exercises
Conclusion
Answers to Exercises
Inheritance
Definitions
Objectives of This Chapter
Taking Inventory
Adding ReorderItems to the Inventory class
Adding Expiration Dates
The protected Access Specifier
static Member Functions
The stream classes
More about stringstream
Review
Exercises
Conclusion
Polymorphism
Definitions
Objectives of This Chapter
Introduction to Polymorphism
Exercises, First Set
Polymorphic Objects
More Definitions
Why We Need Polymorphic Objects
Implementing Safe Polymorphism
Reimplementing the Standard Member Functions for the New Version of StockItem
Avoiding an Infinite Regress During Construction
Reference Counting
Sharing a Worker Object
Why We Need m_Count in StockItem
Review
Exercises, Second Set
Conclusion
The Home Inventory Project
Definitions
Objectives of This Chapter
Data Items for the Home Inventory Project
The Manager/Worker Idiom Again
Hiding Unnecessary Information from the class User
Saving the Number of the Elements in the File
Creating a Data File Programmatically
Adding the Ability to Edit a Record
The New Member Functions of HomeItemMusic
Review
Exercises
Conclusion
More on the Home Inventory Project
Definitions
Objectives of This Chapter
Extending the Functionality of strings
How to Implement Our New string Functionality
The Include Guard
Lessons of the xstring class Implementation
Case-Insensitive Searching
Searching for an Item by a Substring
Putting It All Together
How Software Development Really Works
Review
Conclusion
Analyzing the Home Inventory Project
Definitions
Objectives of This Chapter
The Final Version of the Home Inventory Program
Using a namespace to Group Utility Functions
The Functions of the HomeUtility namespace
Checking the Inventory
Finishing up the HomeItem class
Are We Having Fun Yet?
Review
Exercises
Conclusion
Tying up Loose Ends
Operator Precedence
Another Native Data Type
Wrapping Up
Glossary
Special Characters
A
B
C
D
E
F
G
H
I
K
L
M
N
O
P
R
S
T
U
V
W
Y
Z
About the Author
Bibliography
About the CD-ROM
Technical Support:
License Agreement and Limited Warranty
Acknowledgment
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
int main()
Next
Next Chapter
Input and Output
Exercises, Second Set
2.
Assume that a C string literal starts at memory location 1001. If the contents of memory are as illustrated in
Figure 3.19
, what is the value of the C string literal?
Figure 3.19. A small section of RAM
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset