Hi all,
I am trying to use the variables I have in the struct to store user input about a car.
I have attempted this below, but I am not sure if what I am trying to do is possible. After the information is inputted by the user and stored, it needs to add to a csv file.
My attempt;
Any advice/help would be appreciate..
Thanks in advance!
I am trying to use the variables I have in the struct to store user input about a car.
Code:
struct CarC
{
string carRegistration;
string carOwner;
string carOwnerAddress;
string carManufacturer;
string carModel;
unsigned numCarDoors;
unsigned numCarSeats;
string carType;
string carInformation;
};
My attempt;
Code:
int vehicleOption = 0;
cout << "Automated Number Plate Identification System\n\n";
cout << "Select an Option\n\n";
cout << "1 = Car\n2 = Bus\n3 = Motorbike\n4 = Lorry\n";
cout << "Your Option: ";
cin >> vehicleOption;
if(vehicleOption==1)
{
int loop = 0;
int eloop = 9;
filestr.open ("Vehicles.csv", fstream::in | fstream::out | fstream::app);
if(loop!=eloop)
cout << "Car Registration: "; cin >> carRegistration;
cout << "Car Owner: "; cin >> carOwner;
cout << "Owner Address: "; cin >> carOwnerAddress;
cout << "Car Manufacturer: "; cin >> carManufacturer;
cout << "Car Model: "; cin >> carModel;
cout << "Number of Car Doors: "; cin >> numCarDoors;
cout << "Number of Car Seats: "; cin >> numCarSeats;
cout << "Car Type: "; cin >> carType;
cout << "Other Information: "; cin >> carInformation;
filestr<<" "<<carRegistration<<" "<<carOwner<<" "<<carOwnerAddress<<" "<<carManufacturer<<" "<<carModel<<" "<<numCarDoors<<" "<<numCarSeats<<" "<<carType<<" "<<carInformation<<endl;
}
Thanks in advance!
Comment