I am writing a program for a homework assignment that calculates rental car rates based on make, days rented and miles driven. Overall the program works except, when the user is prompted for the number of cars to be calculated, the program continues to prompt the user for input after the number has been exceeded. Also, the formatting for the miles is correct for the first vehicle entered but changes for subsequent entries.

Any help with these two issues would be greatly appreciated!

Code:

```
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
    // Change the console's background color.
    system ("color F0");

    // Declare the variables.
    char carType;
    string brand, f("Ford"), c("Chevrolet");
    int counter = 0, cars = 0;
    double days, miles, cost_Day, cost_Miles, day_Total;

    cout << "Enter the number of cars you wish to enter: ";
    cin >> cars;
    cin.ignore();

    while (counter <= cars)
    {

        cout << "Enter the car type (F or C): ";
        cin >> carType;
        cin.ignore();
        cout << "Enter the number of days rented: ";
        cin >> days;
        cin.ignore();
        cout << "Enter the number of miles driven: ";
        cin >> miles;
        cin.ignore();

        if (carType == 'F' || carType == 'f')
        {
            cost_Day = days * 40;
            cost_Miles = miles * .35;
            day_Total = cost_Miles + cost_Day;
            brand = f;
        }
        else
        {
            cost_Day = days * 35;
            cost_Miles = miles * .29;
            day_Total = cost_Miles + cost_Day;
            brand = c;
        }

        cout << "\nCar            Days   Miles        Cost\n";
        cout << left << setw(12) << brand << right << setw(6) << days << right << setw(8) << miles 
        << fixed << showpoint << setprecision (2) << setw(8) << right << "$" << day_Total << "\n\n";
        counter++;
    }

        system ("pause");
}

```