Im trying to get a better understanding of structs and I could use some help. Im trying to create a struct which contains a vector of structs, but Im having trouble linking them together. So far I got:
struct Vehicle{
string LicensePlate;
string VehicleType;
vector<string> DamageType;
int EstFixDays;
}veh;
struct DailyCustomers{
string date;
struct Vehicle vehicleList;
}dlc;
int main(){
vector<Vehicle> vehicleList;
struct DailyCustomers dlc;
dlc.date = fileVector[1];
for (int i = 1; i < fileVector.size(); i++){
stringDevide(fileVector[i]);
struct Vehicle veh;
veh.LicensePlate = licensePlate;
veh.VehicleType = vehicleType;
veh.DamageType = vehicleDamageType;
veh.EstFixDays = est;
vehicleList.push_back(veh);
}
dlc.vehicleList = veh;
}
My program seems to be working fine, as the struct linking doesnt affect it, but Im not sure if I linked them together correctly. Should the last line be inside the for
loop?
Any help greatly appreciated. Thank you.
Aucun commentaire:
Enregistrer un commentaire