Electrical and Computer Engineering
26 of 30
UAH
CPE 112
Case Study: Implementation
•void GetData( /* inout */ ifstream& dataFile, 
•              /* out */   int&      deptID,   
•              /* out */   float&    deptSales ) 
•                                            
•// Takes an input accounting file as a parameter, reads
•// the department ID number and number of days of sales
•// from that file, then reads one sales figure for each
•// of those days, computing a total sales figure for
•// the month.  This figure is returned in deptSales.
•// (If input of the department ID fails due to
•// end-of-file, deptID and deptSales are undefined.)
•// Precondition:
•//     dataFile has been successfully opened
•//  && For each department, the file contains a
•//     department ID, number of days, and one sales
•//     figure for each day