Question: my c++ code keeps saying file read error, i need help correcting it. #include #include #include #include #include #include #include using namespace std; struct Person

my c++ code keeps saying file read error, i need help correcting it.

#include #include #include #include #include #include #include using namespace std; struct Person { string firstName; string lastName; int customer_id; }; struct Address { string street; string city; string state; int zip_code; }; struct Date { string month; int day; int year; }; struct Renewal { int months_left; string month_1; int day_1; int year_1; }; struct Customer { Person person; Address address; Date date; Renewal renewal; }; void OpenInputFile(ifstream&); void OpenOutFile(ofstream&); //void PrintHeadingOutput(ofstream&); void OutPutInfo(Customer&, ofstream&); bool InputInfo(Customer&, ifstream&); int main() { ifstream inFile; ofstream outFile; Customer info; OpenInputFile(inFile); OpenOutFile(outFile); // PrintHeadingOutput(outFile); while(InputInfo(info,inFile)) { OutPutInfo(info,outFile); } if (inFile.fail() && !inFile.eof()) { string infilename; cout An error has occured while reading "; cout the input file. Error in file content " Terminating program!!!"> infilename; cin.ignore(INT_MAX,' '); cout Input file failed to open properly!! "; cout Attempted to open file: " Please try again... "; cout > infilename; cin.ignore(INT_MAX,' '); cout > outfilename; cin.ignore(INT_MAX,' '); cout Output file failed to open properly!! "; cout Attempted to open file: " Please try again... "; cout > outfilename; cin.ignore(INT_MAX,' '); cout > info.person.customer_id; getline(inFile, info.address.street,' '); getline(inFile, info.address.city,' '); getline(inFile, info.address.state,' '); inFile >> info.address.zip_code; getline(inFile, info.date.month,' '); inFile >> info.date.day; inFile >> info.date.year; inFile >> info.renewal.months_left; //getline(inFile, info.date.day,' '); //getline(inFile, info.date.year,' '); //getline(inFile, info.renewal.months_left,' '); getline(inFile, info.renewal.month_1,' '); inFile >> info.renewal.day_1; //getline(inFile, info.renewal.day_1,' '); //inFile >> info.address.zip_code; //inFile >> info.date.day; //inFile >> info.date.year; //inFile >> info.renewal.months_left; //inFile >> info.renewal.day_1; inFile.ignore(INT_MAX,' '); return bool(inFile); } //void PrintHeadingOutput(ofstream& outFile) //{ // outFile

my c++ code keeps saying file read error, i need help correctingthis is what the text file should look like after the code is finished.it. #include #include #include #include #include #include #include using namespace std; structand this is what the terminal should look likePerson { string firstName; string lastName; int customer_id; }; struct Address {

Open 2 Joe Saith(14) 3123 Abbey Road 4 Huntsville, Alabana narth 34563 S The last reneval notice was sent an March 19, 2082 644uOS Open 2 Joe Saith(14) 3123 Abbey Road 4 Huntsville, Alabana narth 34563 S The last reneval notice was sent an March 19, 2082 644uOS

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!