![]() |
|
#1
|
|||
|
|||
Import/ExportI was thinking I had this one done. Apparently I was way off the mark. Below is the code I've ended up with, but I have in no way accomplished the project. Exhausted and fed up, will try to tackle again tomorrow.
Project: Assume there are two input files for a payroll program. The first contains the employee’s name (a string), id number (an integer) an hourly rate (a real number). The second contains the employee’s id number and hours worked (a real number). The records in the first file are ordered by name and the records in the second file are ordered by id number. If a person did not work during the current time period, there will be no record in the second file for that person. Write a file of payroll records to an output file for all employees. Each record should contain the employee name followed by # followed by the hours worked, hourly rate, and pay amount. Use a space as a separator between items in the output file. There should be a record in the output file for every person including those who did not work in that pay period. Files given: employees.txt Andrea 1541 7.27 Barry 3794 9.64 Chantal 6260 9.39 Dorian 4740 9.20 Erin 7692 9.18 Fernand 4360 7.14 Gabrielle 2442 8.74 Humberto 5669 9.39 Ingrid 6512 9.16 Jerry 5255 8.08 hours.txt 1541 47 6260 36 4740 37 7692 23 4360 34 2442 25 5669 45 5255 49 CPP / C++ / C Code:
|
|||
|
#2
|
||||
|
||||
Re: Import/ExportQuote:
Perhaps something like this? CPP / C++ / C Code:
Output: Code:
...wouldn't be terribly difficult to convert to writing to a file instead of to stdout. With respect to the current political climate in the USA, of course we knew that "Barry" had no on-the-job hours; campaigning does take a lot of time away from the desk... MxB |
|
#3
|
||||
|
||||
Re: Import/ExportQuote:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#4
|
||||
|
||||
Re: Import/ExportQuote:
...and, he's got the highest pay rate of the bunch! MxB |
Recent GIDBlog
Match IP in CIDR by gidnetwork
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDApp · GIDSearch · Learning Journal by J de Silva, The