ALL I NEED LEFT TO DO IS WRITE A FUNCTION THAT DISPLAYS ANY RECORD ON THE FILE.
ID: 3530467 • Letter: A
Question
ALL I NEED LEFT TO DO IS WRITE A FUNCTION THAT DISPLAYS ANY RECORD ON THE FILE. it should be something like void displayRecord(vector , &items) It should print descriptions to the user, get which index they want, then print the data for that item. The file gets put into a vector and from the vector it displays item description, quantity, wholesale cost, retail cost, and date added to inventory. A program uses a class to store the following inventory data in a file: Item description Quantity on hand Wholesale cost Retail cost Date added to inventory The program should have a menu that allows the user to perform the following tasks:Explanation / Answer
#include #include #include using std::cin; using std::cout; using std::endl; using std::setw; using std::ios; using std::ifstream; using std::ofstream; const int EMPLOYEES = 20; const int MAX = 21; int ReadData( ifstream &inFile, ofstream &outFile, char name[][MAX], int age[] ); void WriteOutputFile( ofstream &outFile, char name[ ][MAX], int age[ ], int counter ); void PrintTotalsAndSummary( ofstream &out, int totalRecords ); int main() { char name[EMPLOYEES][MAX]; int age[EMPLOYEES]; int record_counter(0); ifstream inFile; ofstream outFile( "Chap_11_Report.txt" ); inFile.open( "Chap_11_employee_data.txt" ); if ( inFile.is_open() ) { record_counter = ReadData( inFile, outFile, name, age ); inFile.close(); if( outFile.is_open() ) { WriteOutputFile( outFile, name, age, record_counter ); PrintTotalsAndSummary( outFile, record_counter ); outFile.close(); } else { cout age[counter]; // Priming Read while ( !inFile.eof() ) { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.