0

In one file we have employee number and salary and in another file we have employee number and designation . Now in the output file i want to print salary and designation with corresponding employee number ?

Edited by pritaeas: Moved.

4
Contributors
4
Replies
20
Views
3 Years
Discussion Span
Last Post by glenn_3
0

Probably the fastest way to do that is to read all of file2 into an in-memory array(s). Then start reading file1 line by line. Read a line, search file2 array for employee ID, when found print to third file or to screen. Repeat that for each line in file1.

That might be optimized if both files are sorted by employee ID, such as you would not have to read file2 into memory first.

Exactly how to do that will depend on what programming language you will use.

Edited by Ancient Dragon

0

DSA Students File Handling
[1]Add
[2]View
[3]Exit

DSA Students File Handling
Name:James Bill
Age:35
Course:BSIT
Subject1:Math
Subject2:English
Subject3:Science

Grade in English=80
Grade in Math=80
Grade in Science=80

Record 1BSIT
James Bill 35yrs old
Grade in English=80%
Grade in Math=80%
Grade in Science=80%

Anyone knows how to do solve this problem.

0

here's a trivial example based on linux ....

Desktop:~/code/scripts$ cat sal
23 45000
33 54000
Desktop:~/code/scripts$ cat des
23 manager
33 director
Desktop:~/code/scripts$ join des sal
23 manager 45000
33 director 54000
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.