Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include "invDataTypes.h"
- #include "reports.h"
- using namespace std;
- int main()
- {
- int numberOfVehicles = 20;
- string vehicleTextFile = "vehicles.txt";
- string OptionTextFile = "options.txt";
- string OwnerTextFile = "owner.txt";
- bool flag = true;
- int switcher = 0;
- ///+ array of structs to hold vehicle info
- vehicle vehicleInventory[numberOfVehicles];
- ///+ file management
- ifstream fin;
- ///+ readin vehicle info
- fileHandle(fin,vehicleTextFile);
- vehicleReadIn(fin,vehicleInventory,numberOfVehicles);
- fin.close();
- ///- end vehicle readin
- ///+ readin options info
- fileHandle(fin,OptionTextFile);
- optionsReadIn(fin,vehicleInventory,numberOfVehicles);
- fin.close();
- ///- end options readin
- ///+ readin owners info
- fileHandle(fin,OwnerTextFile);
- ownerReadIn(fin,vehicleInventory,numberOfVehicles);
- fin.close();
- ///- end owners readin
- ///+ initial output of vehicle inventory
- cout << endl;
- printAllVehicles(vehicleInventory,numberOfVehicles);
- ///- end initial output of vehicle inventory
- ///+ switch for option selection. calls the respective function for each option. continued until FLAG becomes 'false'
- while(flag == true)
- {
- cout << endl << "0- Print all vehicles" << endl
- << "1- Print only vehicles manufactured for dealers" << endl
- << "2- Print only vehicles manufactured for individuals" << endl
- << "3- Print only vehicles with 4 cylinder engines" << endl
- << "4- Print only vehicles with premium stereos" << endl
- << "5- Print only vehicles with leather seats" << endl
- << "6- Print all vehicles sorted based on Manufacture Date: " << endl
- << "7- exit program: ";
- cin >> switcher;
- switch(switcher)
- {
- case 0:
- {
- printAllVehicles(vehicleInventory,numberOfVehicles);
- break;
- }
- case 1:
- {
- printDealerVehicles(vehicleInventory,numberOfVehicles);
- break;
- }
- case 2:
- {
- printIndividualVehicles(vehicleInventory,numberOfVehicles);
- break;
- }
- case 3:
- {
- printFourCyln(vehicleInventory,numberOfVehicles);
- break;
- }
- case 4:
- {
- printStereos(vehicleInventory,numberOfVehicles);
- break;
- }
- case 5:
- {
- printLeather(vehicleInventory,numberOfVehicles);
- break;
- }
- case 6:
- {
- vehicle::sortByManufactureDate(vehicleInventory,numberOfVehicles);
- printAllVehicles(vehicleInventory,numberOfVehicles);
- break;
- }
- case 7:
- {
- cout << "Exiting Program. " << endl;
- flag = false;
- break;
- }
- default:
- {
- cout << "You have entered an invalid option: " << endl;
- break;
- }
- }
- }
- ///- end switch
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement