• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 256 pages
Exam (elaborations)

Solution Manual For Introduction to C++ Programming and Data Structures, 5th edition

Document preview thumbnail
Preview 4 out of 256 pages

Strengthen your programming skills with this Solution Manual for Introduction to C++ Programming and Data Structures, 5th Edition. This study resource is designed for college and university students studying computer science, software engineering, and programming fundamentals. It provides structured solutions and learning support to help students understand C++ programming concepts and essential data structures. Key topics include variables, control structures, functions, object-oriented programming, classes, arrays, pointers, recursion, linked lists, stacks, queues, trees, sorting, searching algorithms, and data structure implementation. This PDF is an excellent companion for coursework, coding assignments, programming labs, quizzes, and exam preparation. Students can use this resource to reinforce classroom learning, improve problem-solving skills, and develop stronger programming abilities. Available in a convenient digital format, it allows easy access on computers, tablets, and mobile devices for flexible and efficient studying. Ideal for computer science students seeking organized C++ programming support.

Content preview

Solution Manual For
Introduction to C++ Programming and Data Structures, 5th edition Y Daniel Liang
___________________________________________________________________________________
Chapters 1-27


Chapter 1
Programming Quiz 1.6: Question 1: (00000-10501)

Write a statement that prints Hello World to the screen.
cout << "Hello World";


Programming Quiz 1.6: Question 2: (00000-10502)
Write a complete program that prints Hello World to the screen.

#include <iostream>
using namespace std;
int main()
{
cout << "Hello World";
return 0;
}

Programming Quiz 1.6: Question 3: (00000-10503)
Suppose your name was Alan Turing. Write a statement that would print your last name, followed by a
comma, followed by your first name.

Do not print anything else (that includes blanks).

cout << "Turing,Alan";


Chapter 1: Programming Project 1: (345021-00007)

(Display three messages)

Write a program that displays

Welcome to C++

Welcome to Computer Science

Programming is fun
For a hint on this program, please see https://liangcpp.pearsoncmg.com/cpprevel2e.html. If you get a
logic or runtime error, please refer to https://liangcpp.pearsoncmg.com/faq.html.

#include <iostream>

,using namespace std;

int main()
{
cout << "Welcome to C++" << endl;
cout << "Welcome to Computer Science" << endl;
cout << "Programming is fun" << endl;

return 0;
}

Chapter 1: Programming Project 2: (345021-00008)

(Compute expressions)

Write a program that displays the result of

(9.5 x 4.5 - 2.5 x 3) / (45.5 - 3.5)
For a hint on this program, please see https://liangcpp.pearsoncmg.com/cpprevel2e.html. If you get a
logic or runtime error, please refer https://liangcpp.pearsoncmg.com/faq.html.

#include <iostream>
using namespace std;

int main()
{
cout << (9.5 * 4.5 - 2.5 * 3) / (45.5 - 3.5) << endl;

return 0;
}


Chapter 1: Programming Project 3: (345021-00009)

(Population projection)

The U.S. Census Bureau projects population based on the following assumptions:
One birth every 7 seconds.
One death every 13 seconds.
One new immigrant every 45 seconds

Write a program that displays the population for each of the next five years. Assume the current
population is 312,032,486 and one year has 365 days.

Hint: In C++, if two integers perform division, the result is the quotient. The fractional part is truncated.
For example, is 1 (not 1.25) and is 2 (not 2.5). To get an accuate result with the fractional
part, one of the values involved in the division must be a number with a decimal point. For example, 5.0
/ 4 is 1.25 and .0 is 2.5.

For a hint on this program, please see https://liangcpp.pearsoncmg.com/cpprevel2e.html. If you get a
logic or runtime error, please refer to https://liangcpp.pearsoncmg.com/faq.html.

,#include <iostream>
using namespace std;

int main()
{
cout << 312032486 + 365 * 24 * 60 * .0 - 365 * 24 * 60 * .0 + 365 * 24 * 60 * .0
<< endl;
cout << 312032486 + 2 * 365 * 24 * 60 * .0 - 2 * 365 * 24 * 60 * .0 + 2 * 365 * 24 * 60 *
.0 << endl;
cout << 312032486 + 3 * 365 * 24 * 60 * .0 - 3 * 365 * 24 * 60 * .0 + 3 * 365 * 24 * 60 *
.0 << endl;
cout << 312032486 + 4 * 365 * 24 * 60 * .0 - 4 * 365 * 24 * 60 * .0 + 4 * 365 * 24 * 60 *
.0 << endl;
cout << 312032486 + 5 * 365 * 24 * 60 * .0 - 5 * 365 * 24 * 60 * .0 + 5 * 365 * 24 * 60 *
.0 << endl;

return 0;
}

Chapter 1: Programming Project 4: (345021-00153)

(Simple computation)

The formula for computing the discriminant of a quadratic equation ax^2 + bx + c = 0 is b^2 –
4ac. Write a program that computes the discriminant for the equation 3x^2 + 4x + 5 = 0.

For a hint on this program, please see https://liangcpp.pearsoncmg.com/cpprevel2e.html. If you get a
logic or runtime error, please refer to https://liangcpp.pearsoncmg.com/faq.html.

#include <iostream> // Exercise01_01Extra
using namespace std;

int main()
{
cout << 4 * 4 - 4 * 3 * 5 << endl;

return 0;
}

Chapter 1: Programming Project 5: (345021-00154)

(Physics: acceleration)

Average acceleration is defined as the change of velocity divided by the time taken to make the change,
as shown in the following formula:

a = (v1 - v0) / t

Here, v0 is the starting velocity in meters/second, v1 is the ending velocity in meters/second, and t is
the time span in seconds. Assume v0 is 5.6, v1 is 10.5, and t is 0.5, and write the code to display the
average acceleration.

For a hint on this program, please see https://liangcpp.pearsoncmg.com/cpprevel2e.html. If you get a
logic or runtime error, please refer to https://liangcpp.pearsoncmg.com/faq.html.

, #include <iostream> // Exercise01_02Extra
using namespace std;

int main()
{
cout << (10.5 - 5.6) / 0.5 << endl;

return 0;
}

Chapter 2

Programming Quiz 2.2: Question 1: (00000-10982)
Declare a double variable named distance.

double distance;


Programming Quiz 2.2: Question 2: (00000-10983)
Write a statement that declares a double variable named dosage.

double dosage;


Programming Quiz 2.3: Question 1: (00000-10968)
Write a statement that reads a floating point (real) value from standard input into temperature.
Assume that temperature has already been declared as a double variable.

cin >> temperature;

Programming Quiz 2.5: Question 1: (00000-10514)
Write a complete program that
 declares an int variable,

 reads a value from the keyboard into that variable, and

 writes to standard output the square of the variable's value.
Besides the number, nothing else should be written to standard output.

#include <iostream>
using namespace std;
int main()
{
int k;
cin >> k;
cout << k * k;

return 0;
}

Document information

Uploaded on
November 5, 2026
Number of pages
256
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$13.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
StuviaGuides
4.3
(2333)
Sold
16885
Followers
8366
Items
6218
Last sold
1 hour ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions