An Introduction to Programming with C++: Fifth Edition
978-1-4188-3618-4
Chapter 11 Answers
CONCEPT LESSON
REVIEW QUESTIONS
1.
c
All of the elements in a one-dimensional array have the same subscript.
2.
c
subscript
3.
b
int population[5] = {0};
4.
b
500 with 510
5.
a
20000 with 900
6.
a
display 22000
7.
d
if (x >= 0 && x <= 4)
8.
d
while (x <= 4)
{
sales[x] = sales[x] + 100;
x = x + 1;
}
//end while
9.
b
while (x < 4)
{
total = total + nums[x];
x = x + 1;
}
//end while
avg = static_cast<double>(total) / static_cast<double>(x);
10. a
0.0
11. c
6.0
12. b
5.0
13. d
8.0
14.
a
0, 0
15.
a
combination of two subscripts
16. c
int sales[3][4] = {0};
17.
d
800 with 810
18.
a
20000 with 900
19.
a
display 1300
20. d
if (row >= 0 && row <= 1 && col >= 0 && col <= 4)
21. c
cout << cities[8] << endl;
EXERCISES – PENCIL AND PAPER
1.
int numbers[20] = {0};
numbers[1] = 7;
2.
double rates[5] = {6.5, 8.3, 4.0, 2.0, 10.5};
3.
for (int x = 0; x < 5; x = x + 1)
cout << rates[x] << endl;
//end for
4.
int x = 0;
while (x < 5)
{
cout << rates[x] << endl;
x = x + 1;
}
//end while
5.
double high = rates[0];
int x = 1;
This
preview
has intentionally blurred sections.
Sign up to view the full version.
while (x < 5)
{
if (rates[x] > high)
high = rates[x];
//end if
x = x + 1;
}
//end while
cout << high << endl;
6.
double high = rates[0];
for (int x = 1; x < 5; x = x + 1)
if (rates[x] > high)
high = rates[x];
//end if
//end for

This is the end of the preview.
Sign up
to
access the rest of the document.
- Spring '09
- Katzman
- Duodecimal, Khmer numerals, Text figures
-
Click to edit the document details