C++ Strikes Again
Burncycle
Join Date: 2002-11-24 Member: 9759Members, NS1 Playtester
<div class="IPBDescription">Drat...</div> It's been a semester since I've taken my last C++ class. So I came in, and we're slapped with a refresher problem.
It's a class, that accepts an input from a file (into a struct within the class).
While any one of the three I can easily handle, all three together feels fairly daunting to me. Especially considering the file is binary....
The class will have:
A constructor that accepts the name of the file and opens the file for input.
An Accessor that will read the next record, and return a boolean expression if no more records, returns the next record (a struct) if there is a next record
A destructor that will close the stream
The program will:
Request from the monitor the name of the file
Pass this name to the instance of the class
Print appropriate headings and detail lines
Print total number of customers and total outstanding balances
The input file will be fixed-length records with the following fields:
Customer number -> 5 characters
Customer name -> 20 characters
Oustanding Balance -> float
*le sigh*
*gets back to work*
It's a class, that accepts an input from a file (into a struct within the class).
While any one of the three I can easily handle, all three together feels fairly daunting to me. Especially considering the file is binary....
The class will have:
A constructor that accepts the name of the file and opens the file for input.
An Accessor that will read the next record, and return a boolean expression if no more records, returns the next record (a struct) if there is a next record
A destructor that will close the stream
The program will:
Request from the monitor the name of the file
Pass this name to the instance of the class
Print appropriate headings and detail lines
Print total number of customers and total outstanding balances
The input file will be fixed-length records with the following fields:
Customer number -> 5 characters
Customer name -> 20 characters
Oustanding Balance -> float
*le sigh*
*gets back to work*
Comments