- 分享
- 0
- 人气
- 0
- 主题
- 0
- 帖子
- 11
- UID
- 262091
- 积分
- 11
- 阅读权限
- 11
- 注册时间
- 2009-9-9
- 最后登录
- 2009-9-23
- 在线时间
- 5 小时
![Rank: 1](static/image/common/star_level1.gif)
|
Question 2: Merging and listing selected records using files.
The employee salary details of the two branches (Branch-A and Brach-B) of XYZ company are kept in two separate files (Salary_A.txt and Salary_B.txt) with each line representing information about one employee. The Human Resource Department wants to have only one list showing salary information about all the Branch-A and Brach-B employees together. Therefore the two text files must be combined/merged into a single text file (Salary_AB.txt) which has the Name filed in alphabetical order.
Write a C program to merge the two files to produce a combined file. After creating the combined file the program must be capable of listing the salary details of all the clerks, engineers, or managers (depending on the user selection) with the Name field in alphabetical order and the total salary printed at the end. The program should display the following menu to the user for them to select one of the four options listed.
Sample Menu:
-------------------------
SALARY MENU
------------------------
1. TO LIST CLERKS
2. TO LIST ENGINEERS
3. TO LIST MANAGERS
4. TO EXIT
---------------------------
Please enter your option <1/2/3/4>:
Sample data Salary_A.txt file (sorted on Name field):
Name ID No. Designation Branch Salary(RM)
Abraham 1001 Manger A 3000
Clinton 1003 Clerk A 2000
Ibrahim 1005 Engineer A 4000
King 1007 Engineer A 4000
Sample data for Salary_B.txt file (sorted on Name field):
Name ID No. Designation Branch Salary(RM)
Jasmine 1002 Manger B 3000
Kim 1004 Clerk B 2000
Noor 1006 Engineer B 4000
friday before 4pm need submit, help~
[ 本帖最后由 yangzz 于 2009-9-10 02:16 PM 编辑 ] |
|