#include <iostream>
#include <vector>

using namespace std;

class car{
public:
    int numWheels;
    int numWindows;
    double MPG; // km / l?  UK???
    char name[80];
};

int main(){
    int x;
    cout << "\nHow many cars would you like to add? ";
    cin >>x;
    cin.ignore(); //Need cin.ignore to ignore us hitting enter before we use cin.getline
    
    vector<car> carVec;
    vector<car>::iterator carIter;
    car tempcar;
    
    for(int i=0; i<x; i++){
        cout <<"\nName of car: ";
        cin.getline(tempcar.name, 79);
        
        cout <<"\nNumber of windows: ";
        cin >> tempcar.numWindows;
        
        cout <<"\nNumber of Wheels: ";
        cin >> tempcar.numWheels;
        
        cout <<"\nMPG: ";
        cin >> tempcar.MPG;
        cin.ignore();
        
        carVec.push_back(tempcar);//Put tempcar into the vector
    }
    
    
    for(carIter = carVec.begin(); carIter != carVec.end(); carIter++){ //Start at the beginning, iterate through until carIter = carvec.end
        cout << "Car #: " << (carIter - carVec.begin())+1 <<endl;// carIter - carVec.begin()+1   should equal to 1, or another number if you don't start at 1
        cout << "Name of car: " << carIter ->name <<endl; // Note -> is how we dereference.  In this case It's VERY similar to how we use a subscript w/ an array
        cout << "Number of windows: " << carIter ->numWindows <<endl;//Same as above
        cout << "Number of wheels: " << carIter ->numWheels <<endl;//Same as above
        cout << "MPG: " << carIter ->MPG<<endl<<endl<<endl;//Same as above
    }
    
return 0;
}
