The output wont be alphabetical. You may want to read everything into a container class, sort it, and then write the output file.
C++ container classes should have sort functions built in, so that step becomes 1 line.
For example,
infile1=
aa
ab
ac
infile2=
bb
bc
bd
Your output, I believe, would be
aa
bb
ab
bc
ac
bd
Since you only compare adjacent lines.
|