Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.07 KB | None | 0 0
  1. /*
  2.     Together these structs create a 'vehicle' object which contains the vehicle specification as well as owner information.  Date was included in this header file
  3.     as date in this case is a property of the vehicle.  We have also grouped file I/O functions within this header as these functions are connected to gathering the information
  4.     fed into the vehicle object
  5.  
  6. */
  7.  
  8.  
  9. #ifndef INVDATATYPES_H
  10. #define INVDATATYPES_H
  11. #include <string>
  12.  
  13. struct date
  14. {
  15.     std::string timeStamp;
  16.     int month;
  17.     int day;
  18.     int year;
  19.     double jdn; ///julian date
  20.     /// function converts string 05:11:2016 into month,day,year ints
  21.     void dateToNumber(const std::string& timeStamp, int& month, int& day, int& year);
  22.     void dateToJulian(int& month, int& day, int& year, double& jdn);
  23.  
  24.     ///ctor
  25.     date();
  26. };
  27.  
  28. struct options
  29. {
  30.     std::string seat;
  31.     int wheel_Size;
  32.     std::string stereo;
  33.     std::string winterPackage;
  34.  
  35.     ///ctor
  36.     options();
  37. };
  38.  
  39. struct owner
  40. {
  41.     char ownerType;
  42.     std::string first_name;
  43.     std::string last_name;
  44.     std::string address;
  45.     std::string dealerZip;
  46.  
  47.     ///ctor
  48.     owner();
  49. };
  50.  
  51. struct vehicleSpecifications
  52. {
  53.     std::string modelName;
  54.     int engine_cyl;
  55.     std::string transmission;
  56.     date manufactureDate;
  57.     date shipDate;
  58.     options vehicleOptions;
  59.  
  60.     ///ctor
  61.     vehicleSpecifications();
  62.  
  63. };
  64.  
  65. struct vehicle
  66. {
  67.     int ID;
  68.     vehicleSpecifications thisVehicle;
  69.     owner thisOwner;
  70.  
  71.     ///our top level function for sorting by date
  72.     static void sortByManufactureDate(vehicle vehiclearray[], int& numberofVehicles);
  73.  
  74.     ///ctor
  75.     vehicle();
  76.  
  77.  
  78. };
  79.  
  80.  
  81.  
  82. ///+ These function are file I/O functions
  83. void vehicleReadIn(std::ifstream& fin, vehicle *newVehicle, int& numberofVehicles);
  84. void optionsReadIn(std::ifstream& fin, vehicle *newVehicle, int& numberofVehicles);
  85. void ownerReadIn(std::ifstream& fin, vehicle *newVehicle, int& numberofVehicles);
  86. void fileHandle(std::ifstream& fin, std::string filename);
  87. ///- end file IO functions
  88.  
  89.  
  90. #endif // INVDATATYPES_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement