An Introduction to Programming with C 8th Edition Diane Zak download
An Introduction to Programming with C 8th Edition Diane Zak download
https://ebookname.com/product/an-introduction-to-programming-
with-c-8th-edition-diane-zak/
https://ebookname.com/product/clearly-visual-basic-programming-
with-microsoft-visual-basic-2012-3rd-edition-diane-zak/
https://ebookname.com/product/cgi-perl-web-warrior-series-1st-
edition-diane-zak/
https://ebookname.com/product/microsoft-visual-c-2010-an-
introduction-to-object-oriented-programming-4th-edition-joyce-
farrell/
https://ebookname.com/product/the-protection-of-archaeological-
heritage-in-times-of-economic-crisis-1st-edition-elena-korka-ed/
Policy Concertation and Social Partnership in Western
Europe Lessons for the Twenty First Century 1st Edition
Stefan Berger
https://ebookname.com/product/policy-concertation-and-social-
partnership-in-western-europe-lessons-for-the-twenty-first-
century-1st-edition-stefan-berger/
https://ebookname.com/product/lectures-on-quantum-groups-2nd-
edition-pavel-etingof/
https://ebookname.com/product/functional-food-ingredients-and-
nutraceuticals-processing-technologies-1st-edition-john-shi/
https://ebookname.com/product/the-i-l-peretz-reader-peretz/
https://ebookname.com/product/the-most-controversial-decision-
truman-the-atomic-bombs-and-the-defeat-of-japan-1st-edition-
wilson-d-miscamble-c-s-c/
Gale Encyclopedia of Science 3rd Edition K. Lee Lerner
And Brenda Wilmoth Lerner
https://ebookname.com/product/gale-encyclopedia-of-science-3rd-
edition-k-lee-lerner-and-brenda-wilmoth-lerner/
An Introduction to
Programming with C++
Copyright 2016 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 2016 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.
Eighth Edition
An Introduction to
Programming with C++
Diane Zak
Copyright 2016 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 2016 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.
An Introduction to Programming with C++, © 2016 Cengage Learning
Eighth Edition
WCN: 02-200-203
Diane Zak
Product Director: Kathleen McMahon ALL RIGHTS RESERVED. No part of this work covered by the copyright
herein may be reproduced, transmitted, stored or used in any form or by
Product Team Manager: Kristin McNary any means graphic, electronic, or mechanical, including but not limited to
Senior Product Manager: Jim Gish photocopying, recording, scanning, digitizing, taping, Web distribution,
Senior Content Developer: Alyssa Pratt information networks, or information storage and retrieval systems, except
as permitted under Section 107 or 108 of the 1976 United States Copyright
Product Assistant: Abigail Pufpaff
Act, without the prior written permission of the publisher.
Marketing Manager: Eric LaScola
Senior Production Director:
For product information and technology assistance, contact us at
Wendy Troeger Cengage Learning Customer & Sales Support, 1-800-354-9706
Production Director: Patty Stephan For permission to use material from this text or product, submit all
Senior Content Project Manager: requests online at www.cengage.com/permissions
Jennifer K. Feltri-George Further permissions questions can be emailed to
permissionrequest@cengage.com
Managing Art Director: Jack Pendleton
Cover image(s):
Library of Congress Control Number: 2015940474
© Rudchenko Liliia/Shutterstock.com
ISBN: 978-1-285-86011-4
Unless otherwise noted all screenshots are
Cengage Learning
courtesy of Microsoft Corporation
20 Channel Center Street
Open Clip art source: OpenClipArt Boston, MA 02210
USA
Copyright 2016 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.
v
Brief Contents
Pref ace . . . . . . . . . . . . . . . . . . . . . . . . . xi v
Read T h is B ef o re You Begi n . . . . . . . . . . . . . . . xv i i i
Chapt e r 1 A n I n t ro du ct io n to Programmi ng . . . . . . . . . . . . . . 1
Chapt e r 2 B eg in n in g t h e Probl em- Sol v i ng Process . . . . . . . . . . . 23
Chapt e r 3 Var iables an d Constants . . . . . . . . . . . . . . . . . 51
Chapt e r 4 Co m plet in g t h e Probl em- Sol v i ng Process . . . . . . . . . . 75
Chapt e r 5 T h e Select io n Structure . . . . . . . . . . . . . . . . . 113
Chapt e r 6 M o re o n t h e Selecti on Structure . . . . . . . . . . . . . 157
Chapt e r 7 T h e Repet it io n Structure . . . . . . . . . . . . . . . . 201
C HAPT E R 8 M o re o n t h e Repeti ti on Structure . . . . . . . . . . . . . 247
C HAPT E R 9 Valu e-Ret u r n in g Functi ons . . . . . . . . . . . . . . . . 279
C HAPT E R 10 Vo id F u n ct io n s . . . . . . . . . . . . . . . . . . . . . 329
C HAPT E R 11 On e-Dim en s io n a l Array s . . . . . . . . . . . . . . . . . 369
C HAPT E R 12 Tw o -Dim en s io n a l Array s . . . . . . . . . . . . . . . . . 425
C HAPT E R 13 St r in g s . . . . . . . . . . . . . . . . . . . . . . . . 461
C HAPT E R 14 Sequ en t ial A ccess Fi l es . . . . . . . . . . . . . . . . . 511
C HAPT E R 15 Clas s es an d Obj ects . . . . . . . . . . . . . . . . . . 551
A pp endix A C+ + Keyw o rds . . . . . . . . . . . . . . . . . . . . . 593
A pp endix B A SC II Co des . . . . . . . . . . . . . . . . . . . . . . 595
A pp endix C Co m m o n Syn t ax Errors . . . . . . . . . . . . . . . . . 597
A pp endix D Ho w To B o xes . . . . . . . . . . . . . . . . . . . . . 599
I n dex . . . . . . . . . . . . . . . . . . . . . . . . . 603
Copyright 2016 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
Contents
Pref ace . . . . . . . . . . . . . . . . . . . . . . . . . xi v
R ead T h is B ef o re Yo u Begi n . . . . . . . . . . . . . . . xv i i i
Chapt e r 1 A n I n t ro du ct io n t o Programmi ng . . . . . . . . . . . . . . 1
Programming a Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
The Programmer’s Job . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Employment Opportunities . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
A Brief History of Programming Languages . . . . . . . . . . . . . . . . . . . . 3
Machine Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Assembly Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
High-Level Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Control Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
The Sequence Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
The Selection Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
The Repetition Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
LAB 1-1 Stop and Analyze . . . . . . . . . . . . . . . . . . . . . . . . . . 10
LAB 1-2 Plan and Create . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
LAB 1-3 Modify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
LAB 1-4 What’s Missing? . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Copyright 2016 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.
vii
Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Copyright 2016 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
Contents
Copyright 2016 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.
ix
Copyright 2016 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
Contents
Chapt er 10 Vo id F u n ct io n s . . . . . . . . . . . . . . . . . . . . . 329
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
Creating Program-Defined Void Functions . . . . . . . . . . . . . . . . . . . . 331
Passing Variables to a Function . . . . . . . . . . . . . . . . . . . . . . . . 337
Reviewing Passing Variables by Value . . . . . . . . . . . . . . . . . . . . . 338
Passing Variables by Reference . . . . . . . . . . . . . . . . . . . . . . . 341
LAB 10-1 Stop and Analyze . . . . . . . . . . . . . . . . . . . . . . . . . 345
LAB 10-2 Plan and Create . . . . . . . . . . . . . . . . . . . . . . . . . . 347
LAB 10-3 Modify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
LAB 10-4 What’s Missing? . . . . . . . . . . . . . . . . . . . . . . . . . . 356
LAB 10-5 Desk-Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
LAB 10-6 Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Copyright 2016 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.
xi
Chapter 13 St r in g s . . . . . . . . . . . . . . . . . . . . . . . . 461
The string Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
Getting String Input from the Keyboard . . . . . . . . . . . . . . . . . . . . . 462
The Primrose Auction House Program . . . . . . . . . . . . . . . . . . . . . 464
The ignore Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Determining the Number of Characters in a string Variable . . . . . . . . . . . 471
Accessing the Characters in a string Variable . . . . . . . . . . . . . . . . . 473
Searching the Contents of a string Variable . . . . . . . . . . . . . . . . . . 477
Removing Characters from a string Variable . . . . . . . . . . . . . . . . . . 481
Replacing Characters in a string Variable . . . . . . . . . . . . . . . . . . . 484
Inserting Characters Within a string Variable . . . . . . . . . . . . . . . . . 485
Copyright 2016 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.
xii
Contents
Copyright 2016 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.
xiii
In dex . . . . . . . . . . . . . . . . . . . . . . . . . 603
Copyright 2016 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.
xiv
Preface
An Introduction to Programming with C++, Eighth Edition uses the C++ programming language
to teach programming concepts. This book is designed for a beginning programming course.
Although the book provides instructions for using several specific C++ compilers (such as
® ®
Microsoft Visual C++ , Dev-C++, and Code::Blocks), it can be used with most C++ compilers,
often with little or no modification.
Approach
An Introduction to Programming with C++, Eighth Edition is distinguished from other textbooks
because of its unique approach, which motivates students by demonstrating why they need to
learn the concepts and skills presented. Each chapter begins with an introduction to one or more
programming concepts. The concepts are illustrated with code examples and sample programs.
The sample programs allow the student to observe how the current concept can be used before
they are introduced to the next concept. The concepts are taught using standard C++ commands.
Following the concept portion in each chapter (except Chapter 1) are six labs: Stop and Analyze,
Plan and Create, Modify, What’s Missing?, Desk-Check, and Debug. Each lab teaches students
how to apply the chapter concepts; however, each does so in a different way.
Features
An Introduction to Programming with C++, Eighth Edition is an exceptional textbook because it
also includes the following features:
READ THIS BEFORE YOU BEGIN This section is consistent with Cengage Learning’s
unequaled commitment to helping instructors introduce technology into the classroom.
Technical considerations and assumptions about hardware, software, and default settings are
listed in one place to help instructors save time and eliminate unnecessary aggravation.
LABS Each chapter (except Chapter 1) contains six labs that teach students how to
apply the concepts taught in the chapter to real-world problems. In the first lab,
which is the Stop and Analyze lab, students are expected to stop and analyze an
existing program. Students plan and create a program in the Plan and Create lab,
which is the second lab. The third lab is the Modify lab. This lab requires students to
Copyright 2016 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.
xv
Organization and Coverage
modify an existing program. In the fourth lab, which is the new What’s Missing? lab, students are
asked to find one or more missing instructions in a program. However, before they can
accomplish this task, they must put the existing instructions in the proper order. The fifth lab is
the Desk-Check lab, in which students follow the logic of a program by desk-checking it. The
sixth lab is the Debug lab. This lab gives students an opportunity to find and correct the errors in
an existing program. Answers to the labs are provided in the Answers.pdf file available at
CengageBrain.com. Providing the answers allows students to determine whether they have
mastered the material covered in the chapter.
HOW TO BOXES The How To boxes in each chapter summarize important concepts and
rovide a quick reference for students. The How To boxes that introduce new statements,
p
operators, stream manipulators, or functions contain the syntax and examples of using the syntax.
STANDARD C++ SYNTAX Like the previous edition of the book, this edition uses the standard
C++ syntax in the examples, sample programs, and exercises in each chapter.
PSEUDOCODE AND FLOWCHARTS Both planning tools are shown for many of the programs
within the chapters.
TIP These notes provide additional information about the current concept. Examples
include alternative ways of writing statements, warnings about common mistakes made
when using a particular command, and reminders of related concepts learned in previous
chapters.
MINI-QUIZZES Mini-Quizzes are strategically placed to test students’ knowledge at various
points in each chapter. Answers to the quiz questions are provided in the Answers.pdf file,
allowing students to determine whether they have mastered the material covered thus far before
continuing with the chapter.
WANT MORE INFO? FILES These notes direct students to files that accompany
each chapter in the book. The files contain additional examples and further
explanations of the concepts covered in the chapter. The files are in PDF format and
are available online at CengageBrain.com. Search for the ISBN associated with your
book (from the back cover of your book) using the search box at the top of the page.
This will take you to the product page where free companion resources can be found.
SUMMARY A Summary section follows the labs in each chapter. The Summary section recaps
the programming concepts and commands covered in the chapter.
KEY TERMS Following the Summary section in each chapter is a listing of the key terms
introduced throughout the chapter, along with their definitions.
REVIEW QUESTIONS Review Questions follow the Key Terms section in each chapter.
The Review Questions test the students’ understanding of what they learned in the chapter.
PAPER AND PENCIL EXERCISES The Review Questions are followed by Pencil
and Paper Exercises, which are designated as TRY THIS, MODIFY THIS,
INTRODUCTORY, INTERMEDIATE, ADVANCED, and SWAT THE BUGS. The
answers to the TRY THIS Exercises are provided at the end of the chapter. The
ADVANCED Exercises provide practice in applying cumulative programming k nowledge or
allow students to explore alternative solutions to programming tasks. The SWAT THE BUGS
Exercises provide an opportunity for students to detect and correct errors in one or more lines
of code.
Copyright 2016 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.
xvi
Contents Organization and Coverage
VIDEOS These notes direct students to videos that accompany each chapter in the
book. Many of the videos have been revised from the previous edition. The videos
explain and/or demonstrate one or more of the chapter’s concepts. The videos are
available online at CengageBrain.com. Search for the ISBN associated with your book (from the
back cover of your book) using the search box at the top of the page. This will take you to the
product page where free companion resources can be found.
INSTALLATION VIDEOS These videos, which have been revised from the previous
edition, show students how to install various C++ compilers (such as Microsoft Visual
C++, Dev-C++, and Code::Blocks). The videos are named Ch04-Installation
developmentTool, where developmentTool is the name of the C++ development tool covered in
the video. The videos are available online at CengageBrain.com. Search for the ISBN associated
with your book (from the back cover of your book) using the search box at the top of the page.
This will take you to the product page where free companion resources can be found.
STEP-BY-STEP INSTRUCTIONS This book is accompanied by files that contain step-by-step
instructions for completing Labs 4-2, 4-3, 4-4, 4-6, 5-2, 5-3, and 5-6 using various
C++ compilers. The files, which have been revised from the previous edition, are named
Ch04-Lab4-X developmentTool.pdf and Ch05-Lab5-X developmentTool.pdf, where X represents
the lab number, and developmentTool is the name of the C++ development tool covered in the
file. The files are in PDF format and are available online at www.cengagebrain.com. Search for
the ISBN associated with your book (from the back cover of your book) using the search box at
the top of the page. This will take you to the product page where free companion resources can
be found.
APPENDICES Appendices B, C, D, and E are now Appendices A, B, C, and D. The information
in Appendix A from the previous edition is now contained in the Answers.pdf file.
POW FUNCTION The pow function is now covered along with the built-in value-returning
functions in Chapter 9 (rather than in Chapter 8).
Copyright 2016 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.
xvii
Acknowledgments
Instructor Resources
The following resources are available on the Instructor Companion Site (sso.cengage.com) to
instructors who have adopted this book. Search for this title by ISBN, title, author, or keyword.
From the Product Overview page, select the Instructor’s Companion Site link to access your
complementary resources.
INSTRUCTOR’S MANUAL The Instructor’s Manual follows the text chapter by chapter to assist
you in planning and organizing an effective, engaging course. The manual includes learning
objectives, chapter overviews, ideas for classroom activities, and additional resources. A sample
course Syllabus is also available.
TEST BANK Cengage Learning Testing Powered by Cognero is a flexible, online system that
allows you to:
•• author, edit, and manage test bank content from multiple Cengage Learning solutions
•• create multiple test versions in an instant
•• deliver tests from your LMS, your classroom or wherever you want
POWERPOINT PRESENTATIONS This book comes with Microsoft PowerPoint slides for
each chapter. These are included as a teaching aid for classroom presentation, to make available
to students on the network for chapter review, or to be printed for classroom distribution.
Instructors are encouraged to customize the slides to fit their course needs, and may add slides
to cover additional topics using the complete Figure Files from the text, also available on the
Instructor Companion Site.
SOLUTION FILES Solutions to the Labs, Review Questions, Pencil and Paper Exercises, and
Computer Exercises are available. The Solution Files also contain the sample programs that
appear in the figures throughout the book.
DATA FILES Data Files are required to complete many Labs and Computer Exercises in this
book. They are available on the Instructor Companion Site as well as on CengageBrain.com.
Acknowledgments
Writing a book is a team effort rather than an individual one. I would like to take this
opportunity to thank my team, especially Alyssa Pratt (Senior Content Developer), Jennifer
K. Feltri-George (Senior Content Project Manager), Marisa Taylor (Senior Project Manager),
and Nicole Ashton, Serge Palladino, Chris Scriver (Quality Assurance). Thank you for your
support, enthusiasm, patience, and hard work; it made a difficult task much easier. Last, but
certainly not least, I want to thank Fred D’Angelo, Pima Community College East Campus;
Charles Nelson, Rock Valley College; and Mark Shellman, Gaston College for their invaluable
ideas and comments.
Diane Zak
Copyright 2016 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.
xviii
Technical Information
Data Files
You will need data files to complete the Labs and Computer Exercises in this book. Your
instructor may provide the data files to you. You may obtain the files electronically at
CengageBrain.com. Search for the ISBN associated with your book (from the back cover of your
text) using the search box at the top of the page. This will take you to the product page where
free companion resources can be found.
Each chapter in this book has its own set of data files, which are stored in a separate folder
within the Cpp8 folder. The files for Chapter 4 are stored in the Cpp8\Chap04 folder. Similarly,
the files for Chapter 5 are stored in the Cpp8\Chap05 folder. Throughout this book, you will be
instructed to open files from or save files to these folders.
You can use a computer in your school lab or your own computer to complete the Labs and
Computer Exercises in this book.
Copyright 2016 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.
Chapter 1
An Introduction to
Programming
Copyright 2016 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.
2
Chapter 1 An Introduction to Programming
Programming a Computer
In essence, the word programming means giving a mechanism the directions to accomplish a
task. If you are like most people, you’ve already programmed several mechanisms, such as your
digital video recorder (DVR), cell phone, or coffee maker. Like these devices, a computer also is a
mechanism that can be programmed.
The directions (typically called instructions) given to a computer are called computer programs
or, more simply, programs. The people who write programs are called p rogrammers. Program-
mers use a variety of special languages, called programming languages, to communicate with the
computer. Some popular programming languages are C++, Visual Basic, C#, Java, and Python. In
this book, you will use the C++ programming language.
Employment Opportunities
When searching for a job in computer programming, you will encounter ads for “computer
programmers” as well as for “computer software engineers.” Although job titles and descriptions
vary, computer software engineers typically are responsible for designing an appropriate solution
Ch01-Programmer to a user’s problem, while computer programmers are responsible for translating the solution
Qualities into a language that the computer can understand—a process called coding. Software engineer-
ing is a higher-level position that requires the ability to envision solutions. Using a construction
analogy, software engineers are the architects, while programmers are the carpenters.
Keep in mind that, depending on the employer and the size and complexity of the user’s problem,
the design and coding tasks may be performed by the same employee, no matter what his or her
job title is. In other words, it’s not unusual for a software engineer to code his or her solution, just
as it’s not unusual for a programmer to have designed the solution he or she is coding.
Copyright 2016 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.
3
A Brief History of Programming Languages
Programmers and software engineers need to have strong problem-solving and analytical skills,
as well as the ability to communicate effectively with team members, end users, and other non-
technical personnel. Typically, computer software engineers are expected to have at least a bach-
elor’s degree in software engineering, computer science, or mathematics, along with practical
work experience, especially in the industry in which they are employed. Computer programmers
usually need at least an associate’s degree in computer science, mathematics, or information sys-
tems, as well as proficiency in one or more programming languages.
Computer programmers and software engineers are employed by companies in almost every
industry, such as telecommunications companies, software publishers, financial institutions,
insurance carriers, educational institutions, and government agencies. The Bureau of Labor
Statistics predicts that employment of computer software engineers will increase by 22 p ercent
from 2012 to 2022. The employment of computer programmers, on the other hand, will
increase by 8 percent over the same period. In addition, consulting opportunities for freelance
programmers and software engineers are expected to increase as companies look for ways to
reduce their payroll expenses.
There is a great deal of competition for programming and software engineering jobs, so jobseekers
will need to keep up to date with the latest programming languages and technologies. A competitive
edge may be gained by obtaining vendor-specific or language-specific certifications, as well as knowl-
edge of a prospective employer’s business. More information about computer programmers and
computer software engineers can be found on the Bureau of Labor Statistics Web site at www.bls.gov.
Machine Languages
Within a computer, all data is represented by microscopic electronic switches that can be either
off or on. The off switch is designated by a 0, and the on switch is designated by a 1. Because
computers can understand only these on and off switches, the first programmers had to write
the program instructions using nothing but combinations of 0s and 1s; for example, a program
might contain the instruction 00101 10001 10000. Instructions written in 0s and 1s are called
machine language or machine code. The machine languages (each type of machine has its
own language) represent the only way to communicate directly with the computer. As you can
imagine, programming in machine language is very tedious and error-prone and requires highly
trained programmers.
Assembly Languages
Slightly more advanced programming languages are called assembly languages. The assembly
languages simplify the programmer’s job by allowing the programmer to use mnemonics in
place of the 0s and 1s in the program. Mnemonics are memory aids—in this case, alphabetic
abbreviations for instructions. For example, most assembly languages use the mnemonic ADD
to represent an add operation and the mnemonic MUL to represent a multiply operation. An
example of an instruction written in an assembly language is ADD bx, ax.
Programs written in an assembly language require an assembler, which also is a program,
to convert the assembly instructions into machine code—the 0s and 1s the computer can
Copyright 2016 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.
4
Chapter 1 An Introduction to Programming
understand. Although it is much easier to write programs in assembly language than in machine
language, programming in assembly language still is tedious and requires highly trained
programmers. Programs written in assembly language are machine specific and usually must be
rewritten in a different assembly language to run on different computers.
High-Level Languages
High-level languages represent the next major development in programming languages.
igh-level languages are a vast improvement over machine and assembly languages because
H
they allow the programmer to use instructions that more closely resemble the English language.
An example of an instruction written in a high-level language is grossPay = hours * rate. In
addition, high-level languages are more machine independent than are machine and assembly
languages. As a result, programs written in a high-level language can be used on many different
types of computers.
Programs written in a high-level language usually require a compiler, which also is a program,
to convert the English-like instructions into the 0s and 1s the computer can understand. Some
high-level languages also offer an additional program called an interpreter. Unlike a compiler,
which translates all of a program’s high-level instructions before running the program, an
interpreter translates the instructions line by line as the program is running.
Like their predecessors, the first high-level languages were used to create procedure-oriented
programs. When writing a procedure-oriented program, the programmer concentrates on
the major tasks that the program needs to perform. A payroll program, for example, typically
performs several major tasks, such as inputting the employee data, calculating the gross pay,
calculating the taxes, calculating the net pay, and outputting a paycheck. The programmer must
instruct the computer every step of the way, from the start of the task to its completion. In a
procedure-oriented program, the programmer determines and controls the order in which the
computer processes the instructions. In other words, the programmer must determine not only
the proper instructions to give the computer but the correct sequence of those instructions as
well. Examples of high-level languages used to create procedure-oriented programs include
COBOL (Common Business-Oriented Language), BASIC (Beginner’s All-Purpose Symbolic
Instruction Code), and C.
Most objects More advanced high-level languages can be used to create object-oriented programs in addition
in an object- to procedure-oriented ones. Different from a procedure-oriented program, which focuses
oriented on the individual tasks the program must perform, an object-oriented program requires
program are the programmer to focus on the objects that the program can use to accomplish its goal. The
designed objects can take on many different forms. For example, programs written for the Windows
to perform multiple
environment typically use objects such as check boxes, list boxes, and buttons. A payroll
tasks. These tasks are
program, on the other hand, might utilize objects found in the real world, such as a time card
programmed using the
same techniques used object, an employee object, or a check object.
in procedure-oriented Because each object in an object-oriented program is viewed as an independent unit, an object
programming.
can be used in more than one program, usually with little or no modification. A check object
used in a payroll program, for example, also can be used in a sales revenue program (which
receives checks from customers) and an accounts payable program (which issues checks to
creditors). The ability to use an object for more than one purpose enables code reuse, which
saves programming time and money—an advantage that contributes to the popularity of
Copyright 2016 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.
5
Control Structures
bject-oriented programming. Examples of high-level languages that can be used to create both
o
procedure-oriented and object-oriented programs include C++, Visual Basic, Java, and C#. In this
book, you will learn how to use the C++ programming language to create procedure-oriented
and object-oriented programs.
The answers
Mini-Quiz 1-1 to Mini-Quiz
questions are
contained in the
1. Instructions written in 0s and 1s are called _________________________ language.
Answers.pdf file.
2. When writing a(n) _________________________ program, the programmer
concentrates on the major tasks needed to accomplish a goal.
a. procedure-oriented
b. object-oriented
Control Structures
All computer programs, no matter how simple or how complex, are written using one or more
of three basic structures: sequence, selection, and repetition. These structures are called c
ontrol
structures or logic structures because they control the flow of a program’s logic. In other
words, they control the order in which the computer executes the program’s instructions. You
will use the sequence structure in every program you write. In most programs, you also will
use the selection and repetition structures. This chapter gives you an introduction to the three
control structures. More detailed information about each structure, as well as how to implement
these structures using the C++ language, is provided in subsequent chapters.
Copyright 2016 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.
Exploring the Variety of Random
Documents with Different Content
1648. Thomas Damme buried at Minshull, England, "being of the age of
seven score and fourteen" (154 years).
1725. A party of 40 New Hampshire volunteers on an excursion for
hunting Indians, discovered a party of ten encamped for the night
round a fire. Advancing cautiously at midnight, the enemy were
found asleep and the whole shot. They were marching from Canada
well furnished with new guns and ammunition, and a number of
spare blankets, moccasins and snow shoes, for the accommodation
of the prisoners they expected to take, and were within two miles of
the frontiers. The party entered Dover in triumph, with the ten
scalps stretched on hoops and elevated on poles; and received a
bounty of £100 for each scalp, at Boston, out of the public treasury.
1736. A bill was introduced into the British parliament, placing a duty
of 20 shillings a gallon on spirituous liquors, and £50 license for
selling them, in order to prevent their excessive use; but was
defeated so far as to tolerate punch at a low rate, the merchants of
Bristol and Liverpool fearing the lessening of consumption on rum
and other things distilled from molasses.
1737. Elizabeth Rowe died; an English lady distinguished for her piety
and literary talents.
1745. British ship Chester, Capt. Geary, captured the French ship
Elephant with $24,000 on board.
1749. Usher Gahagan, executed at Tyburn. He was a gentleman by
birth, and a scholar; he edited a beautiful edition of the classics, and
translated Pope's Messiah and Temple of Fame into Latin verse. His
crime was that of clipping coin!
1762. Tobias Mayer, a distinguished mathematician, died at
Gottingen. His lunar and solar tables, as well as his original
suggestions on the repeating circle are of much value.
1771. John James de Mairan, a French philosopher, died. He succeeded
Fontenelle as secretary to the academy of sciences, and is the
author of a Treatise on Phosphoric Light, &c.
1772. The royal marriage act of England was passed. This was
another of those attempts to perpetuate regal domination.
1778. Laura Bassi died; she was honored with the degree of doctor of
philosophy, for the great mental acquirements displayed in her
lectures on that subject, and was distinguished as possessing every
amiable virtue.
1780. British under General Clinton invaded South Carolina.
1781. Robert Morris appointed by congress superintendent of
finance.
1790. Joseph II, emperor of Germany, died. He was an able and
benevolent monarch, who devoted his attention closely to the affairs
of the kingdom, and introduced many useful institutions.
1790. At Blackwall, England, while excavations were being made for
a wet dock several hazel trees, with nuts, were found deeply
imbedded below several strata of sand and clay.
1797. Treaty of Tolentino between Bonaparte and the pope.
1799. El Arish, and subsequently Gaza, with most towns in western
Palestine, were taken by the French.
1799. Leopold II, died; grand duke of Tuscany 25 years, and elected
emperor of Germany, 1790. He evinced great abilities.
1802. John Moore, a distinguished Scottish physician, and popular
author, died. He wrote on the society and manners of different
countries in Europe, which his acute discernment and lively
imagination enabled him to describe with great accuracy and
pleasantry.
1803. British evacuated Egypt.
1808. Gerard Lake died. He was made a peer of Great Britain for his
successes as a general in India.
1809. Richard Gough, a learned and eminent English antiquary, died.
1809. Saragossa surrendered to the French. The garrison was
reduced to 12,000 men, who, when they marched out of the city,
had more the appearance of spectres than of human beings. During
this second siege 54,000 perished, of whom one fourth were
soldiers.
1810. Andrew Hofer, the leader of the Tyrolese insurrection,
executed. He was a brave patriot, and met his fate with heroic
firmness.
1811. Battle of San Christoval in Spain, in which general Mendizabal
was defeated with the loss of about 12,000 killed and prisoners, by
the French under Soult, whose loss was stated at 400 only.
1811. Francis II, of Germany, issued an edict, fixing the current value
of bank paper at one fifth of its nominal value.
1817. Samuel Meredith died at his seat in Wayne county, Pa.; first
treasurer of the United States under the federal constitution, which
office he resigned in 1801.
1820. Arthur Young died; a distinguished English author on
agriculture.
1822. John Stewart, commonly called walking John, died in London;
to gratify the "amor videndi," he had perambulated much of the
globe.
1835. A tremendous earthquake in Chili. The city of Conception,
containing 25,000 inhabitants, was reduced to a heap of ruins, not a
single house left standing; many other towns and villages were
demolished. At first the sea retired and left the vessels in the harbor
aground; but it soon rushed violently back 30 feet above its level.
1836. Mary Crawford, died at Castine, Me., aged 100 years and six
months; widow of Dr. Wm. Crawford, chaplain and surgeon at Fort
Point during the revolution.
1841. James G. Brooks died; known in early life as an American poet,
and later as an editor of several newspapers.
1843. Peter Augustus Jay, well known in the state of New York as a
statesman and historian, died.
1846. The first legislature of Texas under the U. S. met at Austin.
Gen. Henderson was elected the first governor.
1849. Newton M. Curtiss, author of a number of popular novels, died
at Charlton, N. Y., aged 34.
1854. Elliott Cresson, president of the Pennsylvania colonization
society, died, leaving $127,000 to charitable institutions.
1854. The most violent snow storm that had occurred since 1831,
commenced at Washington, and extended over the Middle and New
England states.
1855. Joseph Hume, the English statesman died, aged 78. He was a
member of the house of commons 37 years.
FEBRUARY 21.
1340. The king of England assumed the title of the king of France,
quartering his arms with the motto, "Dieu et mon Droit."
1513. Giuliano Della Rovera, (pope Julius II,) died. He was originally a
fisherman. He built St. Peter's at Rome, to procure means for which
he ordered the sale of indulgences, which was one of the immediate
causes of the reformation; so that it may be said without paradox,
that St. Peter's is the great monument of protestantism. He is
considered one of the most immoral of the popes, though a
generous patron of the polite arts.
1595. Robert Southwell, called sometimes the English Jesuit, died. He
was esteemed no inferior poet in his day.
1633. Order of the privy council to stay several ships in the Thames,
ready to sail for New England with passengers and provisions. The
jealousy of the government was early directed towards the infant
colony of Massachusetts. It was observed by one of the kings, that
the wheat of the population was sifting across the Atlantic. These
orders were ineffectual, for great numbers continued to emigrate,
and scarce a vessel arrived in the colony that was not crowded with
passengers.
1660. The secluded members of the long parliament again took their
seats and voted Monk to be general of the English, Scotch and Irish
forces.
1668. John Thurloe, secretary of state to the two Cromwells, died. He
was a man of very amiable character, and exercised all possible
moderation towards persons of every party.
1676. Two or three hundred Indians principally Narragansetts,
surprised the town of Medfield, Mass., killed 18 men, women and
children, and burnt half of the town.
1682. The following appears in the minutes of the governor and
council of Virginia: "John Buckner called before the Ld. Culpepper
and his counsel for printing the laws of 1680, without his
excellency's license, and he and the printer ordered to enter into
bond in £100 not to print anything hereafter until his majesty's
pleasure shall be known."
1684. Charles Spon, an ingenious and learned French physician, died
at Lyons. He wrote Latin verse with ease and elegance, and
corresponded with most of the learned men of Europe.
1717. Peter Alix, a French protestant of eminent piety and learning,
died. He resided in England, where he was greatly esteemed and
honored.
1730. Benedict XIII, pope of Rome, died. He was a Dominican of
Venice, and before his elevation bishop of Benevento, where his
palace was destroyed by an earthquake, and he narrowly escaped.
He filled the pontifical office six years, and sustained an excellent
character.
1746. Le Bourbon and La Charite, French ships, captured by Com.
Knowles in a heavy gale. The military chest belonging to the French
vessels contained £5,000.
1759. Action between the British frigate Vestal, Capt. Hood, and the
French frigate Bellona, which resulted in the capture of the latter,
with the loss of 42 killed. British loss 2 killed and 22 wounded.
1760. The neighborhood of Mt. Vesuvius overflowed by burning lava.
1760. Commodore Thourot arrived in the bay of Carrickfergus with a
43 gun ship and two sloops of war, and having landed 800 men,
attacked the town, which, with the castle, he carried after a smart
action. The French embarked a few days after, and meeting with a
British squadron, an action ensued in which Thourot and 300 of his
men were killed.
1792. Jacob Schnebbelie died at London. From the profession of a
Swiss confectioner, he rose to be one of the best draughtsmen in
England, but too intense application to his studies hastened his
death.
1796. Field Marshal Clairfait, the Austrian general, resigned, and was
succeeded by the Archduke Charles, for whom a new rank was
created, that of field-marshal-general, being the highest military rank
in the empire.
1799. Gilbert Wakefield was fined £100 and condemned to two years
confinement, for his pamphlet against the bishop of Landaff.
1805. Dominica attacked by a French squadron, which was repulsed
by the British under Gen. Provost.
1810. Action between the British ship Horatio, and French frigate
Necessity, 21 guns, which last was captured in one hour.
1812. Action between the British ship Victorious, Capt. Talbot, and
the Venitian ship Rivoli, 74 guns. The latter was captured, after an
engagement of 5 hours, with the loss of 400 killed and wounded;
British loss 42 k. 99 w.
1813. Ogdensburgh, N. Y., taken by the British.
1814. The British, about 2000 in number, under Col. Scott, crossed
over to the French mills, burnt the arsenal at Malone, N. Y., pillaged
the town and carried off some provisions. The enemy retreated in
great haste, and lost 200 men by desertion. Gen. Wilkinson
endeavored to come up with him, but was prevented by the weather.
1818. David Humphreys, an officer of the revolution, died. He was a
native of Connecticut, and successively aid to generals Putnam,
Greene and Washington. He is also known as a poet of very fair
pretensions.
1824. Eugene de Beauharnais, duke of Leuchtenberg, died. He was the
son of Josephine Tacher de la Pagerie, afterwards wife of Napoleon.
He distinguished himself in the army, and was made viceroy of Italy,
the government of which he managed with great prudence. With the
fall of Napoleon he lost his titles and offices, but was in a measure
indemnified by the articles of Fontainbleau, the congress of Vienna,
and the duke of Bavaria. Under a simple exterior prince Eugene
concealed a noble character and great talents.
1831. Robert Hall died at Bristol, England; a very eminent man and a
celebrated preacher.
1838. Anthony Isaac Sylvestre de Sacy died, aged 80; renowned
principally for his extensive critical knowledge, particularly in oriental
languages and literature; esteemed, in this department of learning,
the first scholar of his age.
1839. Charles Rossi, a celebrated sculptor, died at London, aged 77.
1840. William Frend, died in London, aged 84; a writer on algebra,
taxation and various other subjects.
1845. Sydney Smith, canon of St. Paul's in London, and well known to
Pennsylvania repudiators, died in London.
1855. Charles Roger Dod, assistant editor of The Times newspaper,
died aged 62.
1856. The students of South Carolina college, armed with rifles,
surrendered to the governor of the state and a posse of armed
citizens.
FEBRUARY 22.
1371. David II of Scotland died. He was the son of Robert Bruce, was
taken prisoner by the English in 1346 and detained in the tower 10
years.
1609. Ferdinand I, grand duke of Tuscany, died. He was eminent for
the wisdom and energy of his government.
1630. The first day of public thanksgiving in Massachusetts. The day
had been appointed, for a general fast. No ship had arrived in a
great length of time, and their stock of provisions was nearly
exhausted. At this critical moment a vessel arrived from England
laden with provisions; and they immediately changed the day of
public fasting into one of public feasting. And it is quite probable
that the day was observed with something more than an outward
show of thanksgiving on that occasion.
1644. Charles I, having summoned a royal parliament, they met this
day at Oxford to the number of 44 lords and 118 commoners; the
session was opened with a speech from the king.
1674. Jean Chapelain, died. He attracted the notice of Cardinal
Richelieu by a preface which he wrote for the Adonis of Marini.
Chapelain was talented and learned, obsequious and discreet, and
these made his fortune, for he could be of service to the cardinal,
who had the weakness to set up for a bel esprit. He became one of
the first members of the Academie Francaise, received a large
pension, and became the oracle of the poets of the time, and was
universally esteemed. It would have been better if he himself had
not set up for a poet. In 1630 he commenced an epic, La Pucelle. It
was announced twenty years before its appearance, and the public
expectation was greatly disappointed; it soon became an object of
ridicule.
1717. Great snow in New England; 6 feet deep in Boston. It
commenced on the 20th, on which day Dr. Brattle was buried, and
many who attended his funeral were unable to get home for several
days.
1731. Frederick Ruysch, an eminent Dutch anatomist, died.
1732. Birthday of George Washington. He was the third son of
Augustus Washington, and was born at Bridges Creek, Va.
1744. Partial action off Toulon between the combined French and
Spanish fleets under M. De Court, and the British fleet under
admirals Matthews and Rowley. The Poder, a Spanish 60 gun ship,
was burnt. British loss 92 killed, 185 wounded.
1746. William Couston, director of the French academy of painting
and sculpture, died.
1766. British stamp act repealed.
1770. A mob, principally boys, attacked the house of Mr. Richardson,
Boston, owing to his having attempted to remove the mark set
against the house of one Lille, who had contravened the non-
importation law. Richardson fired upon the mob and killed
Christopher Snider, a boy 11 years of age, who was recorded in the
public prints as the first martyr to American liberty.
1780. An ox roasted on the ice at Philadelphia, the ice being 17
inches thick.
1782. The island of Montserrat surrendered to the French, under
Count De Grasse.
1787. The assembly of notables of France assembled.
1797. The French made a descent on Wales.
1806. James Barry, an Irish painter, died. He was patronized by Burke.
His greatest effort is a series of allegorical pictures in possession of
the Society of arts, London.
1809. Louis, count of Cobentzel, died at Vienna. He was born at
Brussels 1753. He entered into the military service of Austria at an
early age, and was employed as an embassador to the court of
Copenhagen before he had attained his twentieth year; and was
continued in that capacity at some one of the European courts
during the whole of his life.
1810. Charles Brockden Brown, an American novelist, died aged 39.
He holds a distinguished rank among American authors.
1810. The island of St. Eustatia surrendered by the Dutch to the
British.
1811. The British ships Cerberus and Active captured 22 vessels
from Otranto, with provisions and troops.
1812. Ogdensburg, New York, attacked by the British and Indians
under Frazer and McDonnell. Forsythe was compelled to evacuate it.
The British took 12 cannons, 1400 stands of arms, 300 tents, some
provisions, and all the vessels and boats. American loss 27; British
loss 64 killed and wounded.
1814. Blucher defeated by the French under Boyer; the former set
the bridge and town of Mery on fire and fled.
1816. Adam Ferguson, an eminent Scottish writer, died. He was sent to
America as secretary to the mission in 1778 to effect a reconciliation
between the two countries.
1835. Jane Jarmon died near Wadesborough, N. C., aged 105.
1836. Joice Heth died at New York; a blind negro woman, who had
been carried about the country as a show, under the pretence that
she was 162 years of age and had been the nurse of General
Washington. On a post mortem examination it was found that she
could not have been more than 80 years old.
1841. A land slide in the commune of Gregano in Italy, by which 113
persons lost their lives. The town of Reggio, in Calabria, nearly
destroyed by an earthquake.
1855. The San Francisco bankers suspended payment, causing a
panic.
FEBRUARY 23.
FEBRUARY 24.
FEBRUARY 25.
FEBRUARY 26.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com