hi, i m mohan
i hv problem related to file handling.
i hv two txt files emp.txt and dpt.txt.these are following
emp.txt

1111 Tata 1000 12354663
1112 Suresh 1001 -46436433
1113 Hari 1002 46546735
1114 Ramaji 1000 -54651324

where 1111 is a empId,Tata is EmpName,1000 is DeptCode
and 12354663 is Ref.No.and same for all lines

dpt.txt


1000 MMM
1001 NNN
1002 PPP

where 1000 is dept code and MMM is DeptName and same for all lines

i want to write a code so that output will show the dept name and no. of employee
in that dept in the tabular form. out should show like following
name of dept no. of employee
============ ================
MMM 2
NNN 1
PPP 1

Recommended Answers

All 2 Replies

>i want to write a code so that output will show the dept name and no. of employee in that dept in the tabular form.

Start doing it, and stop wasting your time posting the assignment.
Show us your efforts.

commented: Thats the spirit :) +6

If you don't know how to open the file, read about fopen, fclose, etc. If you don't know how to read the information, read about fgets, fread, sscanf, etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.