An Introduction to Programming with C++: Eighth Edition
Chapter 12 Answers
Review Questions
1. a 0, 0
2. c int rates[3][4] = {0};
Exercises Pencil and Paper
1. The answer to this TRY THIS Exercise is located at the end of Chapter 12 in the book.
2. The answer to this TRY THIS Exercise is located at the end of Chapter 12 in the book.
3. for (int col = 0; col < 6; col += 1)
for (int row = 0; row < 4; row += 1)
cout << balances[row][col] << endl;
//end for
//end for
5. int row = 0;
while (row < 4)
{
int col = 0;
while (col < 6)
{
{
balances[row][col] = 100;
row += 1;
} //end while
col += 1;
} //end while
6. int row = 0;
do //begin loop
{
int col = 0;
while (col < 6)
7. answers[2][0] = true;
8. cout << sales[0][0] + sales[1][2] + sales[2][3] << endl;
9. for (int row = 0; row < 10; row += 1)
for (int col = 0; col < 25; col += 1)
quantities[row][col] -= 1;
//end for
//end for
or
} //end while
row += 1;
} //end while
or
11. cout << sqrt(mathNumbers[0][2]) << endl;
12. for (column = 0; column < 5; column += 1)
{
int row = 0;
while (row < 6)
{
cout << prices[row][column] << endl;
row += 1;
} //end while
} //end for
14. int largest = orders[0][0];
int row = 1;
while (row < 5)
{
Exercises Computer
16. The answer to this TRY THIS Exercise is located at the end of Chapter 12 in the book. The code is entered
in the TryThis16.cpp file, which is contained in either the Cpp8\Chap12\TryThis16 Project-IM folder
(Microsoft) or the Cpp8\Chap12 folder (non-Microsoft).
18. See the ModifyThis18.cpp file, which is contained in either the Cpp8\Chap12\ModifyThis18 Project-IM
folder (Microsoft) or the Cpp8\Chap12 folder (non-Microsoft).
19. See the ModifyThis19.cpp file, which is contained in either the Cpp8\Chap12\ModifyThis19 Project-IM
folder (Microsoft) or the Cpp8\Chap12 folder (non-Microsoft).
20. See the ModifyThis20.cpp file, which is contained in either the Cpp8\Chap12\ ModifyThis20 Project-IM
25. See the Advanced25.cpp file, which is contained in either the Cpp8\Chap12\Advanced25 Project-IM folder
(Microsoft) or the Cpp8\Chap12 folder (non-Microsoft).
26. See the Advanced26.cpp file, which is contained in either the Cpp8\Chap12\Advanced26 Project-IM folder
(Microsoft) or the Cpp8\Chap12 folder (non-Microsoft).
27. See the Advanced27.cpp file, which is contained in either the Cpp8\Chap12\Advanced27 Project-IM folder
(Microsoft) or the Cpp8\Chap12 folder (non-Microsoft).
28. See the Advanced28.cpp file, which is contained in either the Cpp8\Chap12\Advanced28 Project-IM folder