An Introduction to Programming with C++: Eighth Edition
Chapter 10 Answers
Review Questions
1. c A void function cannot receive any items of information when it is called.
2. d displayTotal(total);
3. a void getEndBal(int, int);
4. a void getInventory(int b, int s, int p, int &e)
5. c getInventory(beginInv, sales, purchases, endInv);
6. c function header, function prototype
Exercises Pencil and Paper
1. The answer to this TRY THIS Exercise is located at the end of Chapter 10 in the book.
2. The answer to this TRY THIS Exercise is located at the end of Chapter 10 in the book.
3. void getProduct(int num1, int num2, double dblNum, double &answer)
{
getProduct(firstNum, secondNum, thirdNum, product);
4. void calcQuotient(double n1, double n2, double &answer)
{
answer = n1 / n2;
} //end of calcQuotient function
void calcQuotient(double, double, double &); [or void calcQuotient(double
n1, double n2, double &answer);
6. void calcAverage(double num1, double num2, double num3, double &avg)
7.
After the first four statements in the main function are processed:
begVal (main) purchase (main) sale (main) endVal (main)
950 400 700 0
After the statement in the calcEnd function is processed:
650
beg (calcEnd) pur (calcEnd) sale (calcEnd)
950 400 700
8. void calcSalesTax(double sold, double rate, double &tax)
Exercises Computer
9. The answer to this TRY THIS Exercise is located at the end of Chapter 10 in the book. The code is entered
in the TryThis9.cpp file, which is contained in either the Cpp8\Chap10\TryThis9 Project-IM folder
(Microsoft) or the Cpp8\Chap10 folder (non-Microsoft).
10. The answer to this TRY THIS Exercise is located at the end of Chapter 10 in the book. The code is entered
13. See the ModifyThis13.cpp file, which is contained in either the Cpp8\Chap10\ModifyThis13 Project-IM
folder (Microsoft) or the Cpp8\Chap10 folder (non-Microsoft).
14. See the ModifyThis14.cpp file, which is contained in either the Cpp8\Chap10\ModifyThis14 Project-IM
folder (Microsoft) or the Cpp8\Chap10 folder (non-Microsoft).
15. See the Introductory15.cpp file, which is contained in either the Cpp8\Chap10\Introductory15 Project-IM
folder (Microsoft) or the Cpp8\Chap10 folder (non-Microsoft).
16. See the Introductory16.cpp file, which is contained in either the Cpp8\Chap10\Introductory16 Project-IM
folder (Microsoft) or the Cpp8\Chap10 folder (non-Microsoft).
20. See the Intermediate20.cpp file, which is contained in either the Cpp8\Chap10\Intermediate20 Project-IM
folder (Microsoft) or the Cpp8\Chap10 folder (non-Microsoft).
21. See the Advanced21.cpp file, which is contained in either the Cpp8\Chap10\Advanced21 Project-IM folder
(Microsoft) or the Cpp8\Chap10 folder (non-Microsoft).
22. See the Adanced22.cpp file, which is contained in either the Cpp8\Chap10\Advanced22 Project-IM folder
(Microsoft) or the Cpp8\Chap10 folder (non-Microsoft).