Solution Manual for Problem Solving with C++ 10th Edition Savitch - Fast Download To Start Reading Immediately
Solution Manual for Problem Solving with C++ 10th Edition Savitch - Fast Download To Start Reading Immediately
http://testbankbell.com/product/solution-manual-for-data-abstraction-
and-problem-solving-with-c-walls-and-mirrors-7th-editioncarrano/
http://testbankbell.com/product/test-bank-for-electronic-
principles-8th-edition-by-malvino/
Test Bank for Financial Accounting Fundamentals, 4th
Edition : Wild
http://testbankbell.com/product/test-bank-for-financial-accounting-
fundamentals-4th-edition-wild/
http://testbankbell.com/product/solution-manual-for-essentials-of-
business-analytics-1st-edition/
http://testbankbell.com/product/test-bank-for-fundamentals-of-
corporate-finance-2nd-edition-jonathan-berk-peter-demarzo-jarrad-
hartford/
http://testbankbell.com/product/test-bank-for-human-geography-people-
place-and-culture-11th-edition-by-fouberg-murphy-de-blij/
http://testbankbell.com/product/test-bank-for-human-behavior-in-the-
macro-social-environment-3rd-edition/
Solution Manual for Mathematical Applications for the
Management, Life, and Social Sciences, 11th Edition
http://testbankbell.com/product/solution-manual-for-mathematical-
applications-for-the-management-life-and-social-sciences-11th-edition/
Solution Manual for Problem Solving
with C++ 10th Edition Savitch
Full download chapter at:
https://testbankbell.com/product/solution-manual-for-problem-
solving-with-c-10th-edition-savitch/
PROBLEM
SOLVING
WITH
C++
Tenth Edition
Walter Savitch
UNIVERSITY OF CALIFORNIA, SAN DIEGO
http://www.pearsonhighered.com/savitch/
and please visit our general computer science and engineering web site at:
http://www.pearsonhighered.com/cs/
Copyright © 2018 by Pearson Education, Inc.
All right reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, photo-copying, recording, or any
other media embodiments now known or hereafter to become known, without the prior written
permission of the publisher. Manufactured in the United States of America.
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where these designations appear in this book, and the publisher was aware
of a trademark claim, the designations have been printed in initial caps or all caps.
The programs and the applications presented in this book have been included for their
instructional value. They have been tested with care but are not guaranteed for any particular
purpose. The publisher does not offer any warranties or representations, nor does it accept any
liabilities with respect to the programs or applications.
Chapter 7 Arrays
Chapter 14 Recursion
Chapter 15 Inheritance
Chapter 17 Templates
Chapter 1
This document is intended to be a resource guide for instructors using Savitch, Problem Solving with
C++. This guide follows the text chapter by chapter. Each chapter of this guide contains the
following sections:
1. Solutions to, and remarks on, selected Programming Projects
2. Outline of topics in the chapter
3. General remarks on the chapter
***********************************************************************
// Ch1 Programming Project 3.cpp
//
// This program calculates the monetary value of a number of
// quarters, dimes, and nickels.
//
***********************************************************************
#include <iostream>
// ====================
// main function
// ====================
int main()
{
int quarters, dimes, nickels, total;
// Input coins
cout << "Enter number of quarters." << endl;
cin >> quarters;
6
Copyright © 2018 Pearson Education, Inc.
Savitch Instructor’s Resource Guide
Problem Solving w/ C++, 10e Chapter 1
#include <iostream>
using namespace std;
int main()
{
int ACCELERATION = 32;
cout << "\nThe object will fall " << distance << " feet in "
<< time << " seconds.\n";
return 0;
}
7
Copyright © 2018 Pearson Education, Inc.
Savitch Instructor’s Resource Guide
Problem Solving w/ C++, 10e Chapter 1
There seem to be three major approaches to teaching C++ as the first course in programming. In the
one approach, classes and objects are done very early, frequently with a library of some sort that
must be used with the text. In another, all of the ANSI C subset of C++ is covered prior to even
mentioning classes or objects. This text takes a third road that is more middle of the road. Here,
enough of the control constructs and functions are covered prior to doing classes and objects.
However, reorderings of the chapters are possible that allow any of these approaches.
Here is a "classes early" course that follows the text closely. This outline assumes no background in
computing. Topics beyond Chapter 11 may be studied as time permits.
Day days allotted
1 1 Startup business
2-3 2 Chapter 1: Introduction to Computers
4-8 5 Chapter 2: C++ Basics. If the students have programming experience, the time
spent can be significantly reduced.
9-11 3 Chapter 3: Flow of control
12-14 3 Chapter 4: Procedural Abstraction
Test 1
16-18 3 Chapter 5: Functions for all subtasks
19-22 4 Chapter 6: I/O Streams
23-27 5 Chapter 7: Arrays
Test 2
29-32 4 Chapter 8: Strings and Vectors
Chapter 9: Pointers and Dynamic Arrays
33-37 5 Chapter 10: Classes
38-41 3 Chapter 11: Friends and Overloaded Operators
Test 3
5 Chapter 12 Separate compilation and namespaces
3 Chapter 13 Pointers and Linked Lists
3 Chapter 14: Recursion
3 Chapter 15: Inheritance
3 Chapter 16: Exception Handling
3 Chapter 17: Templates
2 Chapter 18: Standard Template Library and C++11
Reorderings:
The author suggests a reordering in the preface that allow almost all of ANSI C (with the tighter
C++ type-checking) to be covered before classes. Several variants on this reordering that allow
classes a bit earlier are presented in the text. The author describes interdependency of the chapters
in the preface of the text. Other reorderings are certainly possible.
8
Copyright © 2018 Pearson Education, Inc.
Savitch Instructor’s Resource Guide
Problem Solving w/ C++, 10e Chapter 1
Chapter 1:
The student should do all the programming assignments in this chapter. These teach the locally
available program development system and familiarize the student with some of the more
common compiler errors. Error messages are quite specific to the compiler being used. It is very
important that the student learn these ideas as early as possible.
This chapter serves as an introduction to computers and the language of computers for those
students who have no computer experience. The terminology is very important. Many students
only want to learn how the programming language works, and seem to be unhappy when they
find that they are required to learn the terminology associated with the language. The students
who learn the terminology have less trouble by far with this course.
Students should be given an indication of the amount of work that must be done before coding
begins. There are instances where several man-years of work have gone into software before a
single line of code was written.
Emphasize the importance of the problem-solving phase of program design. This will save the
student work in the long run. It is further important to emphasize that the problem definition and
algorithm design phases may need correcting once the actual coding and testing is in process. This
is true even if the algorithm was carefully desktop tested. Emphasize that the program design
process is an 'iterative' process. You make a start, test, correct and repeat until you have a solution.
It is a fact that the sooner the coding is started (on most problems), the longer the problem will take
to finish. My students insist on learning this the hard way. The algorithm design can be given a
boost by dividing the problem definition into INPUT, PROCESS, OUTPUT phases. The algorithm
will be primarily concerned with PROCESS, but frequently just getting information into the
computer, or out of the computer in a desirable format is a significant part of the task, if not the
whole problem.
In the text, Section 1.4, subsection "Kinds of Program Errors", there is a discussion of compiler error
messages. The error message from g++ when the wrong operator << or >> is used for input or
output, is something like errormessage.cpp:8: no match for `_IO_ostream_withassign & >> int. The
point is that compiler error messages are not clear, and anything your can do to help students to
associate error messages with errors that cause them will help the student to gain some intuition in
debugging based on compiler messages.
9
Copyright © 2018 Pearson Education, Inc.
Savitch Instructor’s Resource Guide
Problem Solving w/ C++, 10e Chapter 1
Encourage students to put only one statement per line. When errors are made, as they inevitably
are, the compiler is better able to tell us which is the offending statement. The cost is little for the
convenience gained in ability to find errors. The student should take compiler warnings to heart. If
the compiler warns about something, and the student is not absolutely certain what the message is
warning about, the student should treat the warning like the error that it probably is. The bottom
line is that all warnings (in the first course, at least) should be treated as errors. Compilers vary
with respect to what is reported as an error and what is reported with a warning. The GNU project
C++ compiler, g++ is more permissive by default. Encourage your students to compile using
10
Copyright © 2018 Pearson Education, Inc.
Another Random Scribd Document
with Unrelated Content
a veteran of the French war, grandfather of one of the most eminent
of American historians. On reaching the grounds, a consultation was
held, and it was decided, in accordance with the general purpose, if
not in strict conformity to the letter of the order, to push on farther
and fortify the eminence known as Breed’s Hill, which was connected
by a ridge with Bunker Hill, and might be regarded as part of the
same locality. The position of Breed’s Hill was
Americans
admirably fitted for annoying the town and the ships in occupy
the harbour, and it was believed that, should the Bunker Hill
Americans succeed in planting batteries there, the
British would be obliged to retire from Boston. There can be little
doubt, however, that in thus departing from the strict letter of his
orders Prescott made a mistake, which might have proved fatal, had
not the enemy blundered still more seriously. The advanced position
on Breed’s Hill was not only exposed to attacks in the rear from an
enemy who commanded the water, but the line of retreat was ill
secured, and, by seizing upon Charlestown Neck, it would have been
easy for the British, with little or no loss, to have compelled Prescott
to surrender. From such a disaster the Americans were saved by the
stupid contempt which the enemy felt for them.
Along with Morgan and Arnold there might have been seen on
Cambridge Common a man who was destined to play no less
conspicuous a part in the great campaign which was to end in the
first decisive overthrow of the British. For native shrewdness, rough
simplicity, and dauntless courage, John Stark was much like Morgan.
What the one name was in the great woods of the Virginia frontier,
that was the other among the rugged hills of northern New England,
—a symbol of patriotism and a guarantee of victory. Great as was
Stark’s personal following in New Hampshire, he had not, however,
the chief command of the troops of that colony. The
John
commander of the New Hampshire contingent was Sullivan
John Sullivan, a wealthy lawyer of Durham, who had
sat in the first Continental Congress. Sullivan was a gentleman of
culture and fair ability as a statesman. As a general, he was brave,
intelligent, and faithful, but in no wise brilliant. Closely associated
with Sullivan for the next three years we shall find Nathanael Greene,
now in command of the Rhode Island contingent. For
Nathanael
intellectual calibre all the other officers here mentioned Greene
are dwarfed in comparison with Greene, who comes
out at the end of the war with a military reputation scarcely, if at all,
inferior to that of Washington. Nor was Greene less notable for the
sweetness and purity of his character than for the scope of his
intelligence.[7] He had that rare genius which readily assimilates all
kinds of knowledge through an inborn correctness of method.
Whatever he touched, it was with a master hand, and
Henry Knox
his weight of sense soon won general recognition.
Such a man was not unnaturally an eager book-buyer, and in this way
he had some time ago been brought into pleasant relations with the
genial and intelligent Henry Knox, who from his bookshop in Boston
had come to join the army as a colonel of artillery, and soon became
one of Washington’s most trusty followers.
Of this group of officers, none have as yet reached
Older
very high rank in the Continental army. Sullivan and officers
Greene stand at the end of the list of brigadier-
generals; the rest are colonels. The senior major-general, Artemas
Ward, and the senior brigadiers, Pomeroy Heath, Thomas, Wooster,
and Spencer, will presently pass into the background, to make way
for these younger or more vigorous men. Major-
Israel
General Israel Putnam, the picturesque wolf-slayer, a Putnam
brave and sterling patriot, but of slender military
capacity, will remain in the foreground for another year, and will then
become relegated mainly to garrison duty.
With the exception of Morgan, all the officers here noticed are
New England men, as is natural, since the seat of war is in
Massachusetts, and an army really continental in complexion is still to
be formed. The Southern colonies have as yet contributed only
Morgan and the commander-in-chief. New York is represented in the
Continental army by two of the noblest of American heroes,—Major-
General Philip Schuyler and Brigadier-General Richard Montgomery;
but these able men are now watching over Ticonderoga and the
Indian frontier of New York. But among the group
Horatio
which in 1775 met for consultation on Cambridge Gates and
Common, or in the noble Tory mansion now hallowed Charles Lee
alike by memories of Washington and of Longfellow,
there were yet two other generals, closely associated with each other
for a time in ephemeral reputation won by false pretences, and
afterwards in lasting ignominy. It is with pleasure that one recalls the
fact that these men were not Americans, though both possessed
estates in Virginia; it is with regret that one is forced to own them as
Englishmen. Of Horatio Gates and his career of imbecility and
intrigue, we shall by and by see more than enough. At this time he
was present in Cambridge as adjutant-general of the army. But his
friend, Charles Lee, was for the moment a far more conspicuous
personage; and this eccentric creature, whose career was for a long
time one of the difficult problems in American history, needs
something more than a passing word of introduction.
WASHINGTON’S HEADQUARTERS
Although Major-General Charles Lee happened to have acquired
an estate in Virginia, he had nothing in common with the illustrious
family of Virginian Lees beyond the accidental identity of name. He
was born in England, and had risen in the British army to the rank of
lieutenant-colonel. He had served in America in the Seven Years’ War,
and afterward, as a soldier of fortune, he had wandered about
Europe, obtaining at one time a place on the staff of the king of
Poland. A restless adventurer, he had come over again
Lee’s
to America as soon as he saw that a war was brewing personal
here. There is nothing to show that he cared a rush for peculiarities
the Americans, or for the cause in which they were fighting, but he
sought the opportunity of making a name for himself. He was
received with enthusiasm by the Americans. His loud, pompous
manner and enormous self-confidence at first imposed upon
everybody. He was tall, lank, and hollow-cheeked, with a
discontented expression of face. In dress he was extremely slovenly.
He was fond of dogs, and always had three or four at his heels, but
toward men and women his demeanour was morose and insulting.
He had a sharp, cynical wit, and was always making severe remarks
in a harsh, rough voice. But the trustful American imagination
endowed this unpleasant person with the qualities of a great soldier.
His reputation was part of the unconscious tribute which the
provincial mind of our countrymen was long wont to pay to the men
and things of Europe; and for some time his worst actions found a
lenient interpretation as the mere eccentricities of a wayward genius.
He had hoped to be made commander-in-chief of the army, and had
already begun to nourish a bitter grudge against Washington, by
whom he regarded himself as supplanted. In the following year we
shall see him endeavouring to thwart the plans of Washington at the
most critical moment of the war, but for the present he showed no
signs of insincerity, except perhaps in an undue readiness to parley
with the British commanders. As soon as it became clear that a war
was beginning, the hope of winning glory by effecting an
accommodation with the enemy offered a dangerous temptation to
men of weak virtue in eminent positions. In October, Benjamin
1775, the American camp was thrown into great Church
consternation by the discovery that Dr. Benjamin
Church, one of the most conspicuous of the Boston leaders, had
engaged in a secret correspondence with the enemy. Dr. Church was
thrown into jail, but as the evidence
of treasonable intent was not
absolutely complete, he was set free
in the following spring, and allowed
to visit the West Indies for his
health. The ship in which he sailed was never heard from again. This
kind of temptation, to which Church succumbed at the first outbreak
of the war, beset Lee with fatal effect after the Declaration of
Independence, and wrought the ruin of Arnold after the conclusion of
the French alliance.
To such a man as Charles Lee, destitute of faith in the loftier
human virtues or in the strength of political ideas, it might easily
have seemed that more was to be hoped from negotiation than from
an attempt to resist Great Britain with such an army as that of which
he now came to command the left wing. It was fortunate that the
British generals were ignorant of the real state of things. Among the
moral effects of the battle of Bunker Hill there was one which proved
for the moment to be of inestimable value. It impressed upon
General Howe, who now succeeded to the chief command, the
feeling that the Americans were more formidable than had been
supposed, and that much care and forethought would be required for
a successful attack upon them. In a man of his easy-going
disposition, such a feeling was enough to prevent decisive action. It
served to keep the British force idle in Boston for months, and was
thus of great service to the American cause. For in spite of the zeal
and valour it had shown, this army of New England minute-men was
by no means in a fit condition for carrying on such an arduous
enterprise as the siege of Boston. When Washington took command
of the army on Cambridge Common, he found that the first and most
trying task before him was out of this excellent but very raw material
to create an army upon which he could depend. The
Difficult
battle of Bunker Hill had just been lost, under work for
circumstances which were calculated to cheer the Washington
Americans and make them hopeful of the future; but it
would not do to risk another battle, with an untrained staff and a
scant supply of powder. All the work of organizing an army was still
to be done, and the circumstances were not such as to make it an
easy work. It was not merely that the men, who were much better
trained in the discipline of the town meeting than in that of the camp,
needed to be taught the all-important lesson of military
subordination: it was at first a serious question how they were to be
kept together at all. That the enthusiasm kindled on the day of
Lexington should have sufficed to bring together 16,000 men, and to
keep them for three months at their posts, was already remarkable;
but no army, however patriotic and self-sacrificing, can be supported
on enthusiasm alone. The army of which Washington took command
was a motley crowd, clad in every variety of rustic attire, armed with
trusty muskets and rifles, as their recent exploit had shown, but
destitute of almost everything else that belongs to a soldier’s outfit.
From the Common down to the river, their rude tents were dotted
about here and there, some made of sail-cloth stretched over poles,
some piled up of stones and turf, some oddly wrought of twisted
green boughs; while the more fortunate ones found comparatively
luxurious quarters in Massachusetts Hall, or in the little Episcopal
church, or in the houses of patriotic citizens. These volunteers had
enlisted for various periods, for the most part short, under various
contracts with various town or provincial governments. It was not
altogether clear how they were going to be paid, nor was it easy to
see how they were going to be fed. That this army should have been
already subsisted for three months, without any commissariat, was in
itself an extraordinary fact. Day by day the heavy carts had rumbled
into Cambridge, bringing from the highlands of Berkshire and
Worcester, and from the Merrimac and Connecticut valleys, whatever
could in any wise be spared of food, or clothing, or medicines, for the
patriot army; and the pleasant fields of Cambridge were a busy scene
of kindness and sympathy.
A Westerly View of the Colledges in Cambridge New
England
Such means as these, however, could not long be efficient. If war
was to be successfully conducted, there must be a commissariat,
there must be ammunition, and there must be money. And here
Washington found himself confronted with the difficulty which never
ceased to vex his noble soul and disturb his best laid schemes until
the day when he swooped down upon Cornwallis at Yorktown. He
had to keep making the army, with which he was often
Absence of
expected to fight battles ere it was half made; and in government
this arduous work he could get but little systematic al
help from any quarter. At present the difficulty was organization
that there was nowhere any organized government
competent to support an army. On Washington’s arrival, the force
surrounding Boston owed allegiance, as we have seen, to four
distinct commonwealths, of which two, indeed,—Connecticut and
Rhode Island,—preserving their ancient charters, with governors
elected by themselves, were still in their normal condition. In New
Hampshire, on the other hand, the royal governor, John Wentworth,
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
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.
testbankbell.com