|
|
|
|
|
|
|
GetData(store1, deptID1, sales1); // Printing reads
GetData(store2, deptID2, sales2);
while (store1 && store2) // While not EOF
{
cout < endl;
PrintData(deptID1, 1, sales1); // Process Store 1
PrintData(deptID2, 2, sales2); // Process Store 2
GetData(store1, deptID1, sales1);
GetData(store2, deptID2, sales2);
}
return 0;
}
//******************************************************************
void PrintHeading()
// Prints the title for the bar chart, a heading, and the numeric
// scale for the chart. The scale uses one mark per $500
// Postcondition:
// The heading for the bar chart has been printed
{
cout
< Bar Graph Comparing Departments of Store #1 and Store #2
< endl < endl
< Store Sales in 1,000s of dollars < endl
< # 0 5 10 15 20 25
< endl
< |.........|..........|..........|..........|..........|
< endl;
}
//******************************************************************
void GetData( /* inout */ ifstream& dataFile, // Input file
/* out */ int& deptID, // Department number
/* out */ float& deptSales ) // Department's
// monthly sales
// 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.)
|
|
|
|
|
|