// This program calculates the charges for DVD rentals.
2 // Every third DVD is free.
3 #include <iostream>
4 #include <iomanip>
5 using namespace std;
6
7 int main()
8 {
9 int dvdCount = 1; // DVD counter
10 int numDVDs; // Number of DVDs rented
11 double total = 0.0; // Accumulator
12 char current; // Current release, Y or N
13
14 // Get the number of DVDs.
15 cout << "How many DVDs are being rented? ";
16 cin >> numDVDs;
17
18 // Determine the charges.
19 do
20 {
21 if ((dvdCount % 3) == 0)
22 {
23 cout << "DVD #" << dvdCount << " is free!\n";
24 continue; // Immediately start the next iteration
25 }
26 cout << "Is DVD #" << dvdCount;
27 cout << " a current release? (Y/N) ";
28 cin >> current;
29 if (current == 'Y' || current == 'y')
30 total += 3.50;
31 else
32 total += 2.50;
33 } while (dvdCount++ < numDVDs);
34
35 // Display the total.
36 cout << fixed << showpoint << setprecision(2);
37 cout << "The total is $" << total << endl;
38 return 0;
39 }
The question is:
20. Each repetition of a loop is known as a(n) __________.