// This program calculates the charges for video rentals. // Every third video is free. #include #include using namespace std; int main() { int videoCount = 1; // Video counter int numVideos; // Number of videos rented double total = 0.0; // Accumulator char current; // Current release, Y or N // Get the number of videos. cout << "How many videos are being rented? "; cin >> numVideos; // Determine the charges. do { if ((videoCount % 3) == 0) { cout << "Video #" << videoCount << " is free!\n"; continue; // Immediately start the next iteration } cout << "Is video #" << videoCount; cout << " a current release? (Y/N) "; cin >> current; if (current == 'Y' || current == 'y') total += 3.50; else total += 2.50; } while (videoCount++ < numVideos); cout << fixed << showpoint << setprecision(2); cout << "The total is $" << total; return 0; }