1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#include <iostream>
#include "OvernightPackage.h"
#include "Package.h"
#include "Person.h"
#include "TwoDayPackage.h"
#include <iomanip>
#include <fstream>
#include <vector>
int main(){
std::string Name_S, Address_S, City_S, State_S, ZipCode_S,
Name_R,Address_R, City_R, State_R, ZipCode_R;
double Weight, CostPerOunce, flatRateIncrease, tDcostPerOunce;
char packageType;
std::ifstream inFile;
inFile.open("package.txt");
Package *A;
//Error occurring below
vector<Package> regularPackages;
vector<TwoDayPackage> tDPackages;
vector<OvernightPackage> oNPackages;
//End of error, area
while(inFile >> packageType){
inFile >> Weight;
inFile >> CostPerOunce;
inFile.ignore();
getline(inFile, Name_S);
getline(inFile, Address_S);
getline(inFile, City_S);
getline(inFile, State_S);
getline(inFile, ZipCode_S);
getline(inFile, Name_R);
getline(inFile, Address_R);
getline(inFile, City_R);
getline(inFile, State_R);
getline(inFile, ZipCode_R);
if(packageType == 'P' || packageType == 'p'){
A = new Package(Name_S, Address_S, City_S, State_S, ZipCode_S,
Name_R,Address_R, City_R, State_R, ZipCode_R, Weight, CostPerOunce);
A->printLable();
}
if(packageType == 'O' || packageType == 'o'){
inFile >> flatRateIncrease;
A = new OvernightPackage(Name_S, Address_S, City_S, State_S, ZipCode_S,
Name_R,Address_R, City_R, State_R, ZipCode_R, Weight, CostPerOunce, flatRateIncrease);
A->printLable();
}
if(packageType == 'T' || packageType == 't'){
inFile >> tDcostPerOunce;
A = new TwoDayPackage(Name_S, Address_S, City_S, State_S, ZipCode_S,
Name_R,Address_R, City_R, State_R, ZipCode_R, Weight, CostPerOunce,tDcostPerOunce);
A->printLable();
}
}
system("pause");
return 0;
}
|