Template struct

completed
Last edited on
Should be like reading any other CSV file and then outputting according to what you read in.

Have you worked with basic file input/output?

http://www.cplusplus.com/forum/general/13087/

Basically you just read in each line and then parse accordingly.


Though you never mentioned how the file is setup. It could be setup in XML format which would make parsing differently. Would you please show us your code and the file format.
Last edited on
The file is just a simple text file:

5
1567
John Q. Public
33937
15.99
39
Jane R. Public
33938
14.33
40
John S. Public
33939
13.99
42
Jane Smith
33940
17.53
35
John Smith
33941
16.25
38


The cmd output should look like this:

(Run 1 of program)


Welcome to our Awesome Payroll Program (TM)
What would you like to do:
1. Print a single paycheck.
2. Print all entire payroll.
3. Print employee information.

Please enter your choice: 2
Please enter the data file name: employees.txt
____________________________________________________________
|
| Awesome Payroll Inc. Check Number: 1567
| 2220 N. Payroll Ave.
| Martin, TN 38237
|
| Pay: $623.61
| To the order of: John Q. Public
| 33937 (Employee ID)
| 15.99 (Pay Rate)
| 39 (Hours Worked)
|
| Official Payroll Signature: _________________________
|____________________________________________________________


*Followed by the rest of the checks for each person.
I do not have any code yet for the program, I have just started about 10 minutes ago.
So first you have to read in the first line which will determine how many times you need to read in the rest of the information.

in this case 5 so then you will be able to use a for loop and iterate 5 times.

Each time you read in the next 5 lines (You can read them in as strings) and then output, and continue to the next line.

If you have a structure created you could read all the information in, save it, and then output at the end.

You are going to need to use:
strings
for loop
ifstream
cout
Topic archived. No new replies allowed.