A C E |
B D F |
A C E B D F |
A B C D E F |
|
|
|
|
|
|
|
|
|
|
|
|
line1 as if it was an output stream. You should use your output stream write instead.if, that is: .fail() instead of .eof(). Apologies for misleading you there.Edward Letterhead Elegant 96.00 8 Fred Note Imagine 62.50 5 Garrett Letterhead Excelsior 68.50 3 Jim Note Imagine 62.50 12 Karen Note Imagine 62.50 11 |
Carl Letterhead Elegant 96.00 10 Dave Note Imagine 62.50 20 John Letterhead Excelsior 68.50 31 Kristen Letterhead Excelsior 68.50 55 Larry Note Imagine 62.50 48 |
Letterhead Elegant 96.00 10 Note Imagine 62.50 20 Letterhead Elegant 96.00 8 Note Imagine 62.50 5 Letterhead Excelsior 68.50 3 Note Imagine 62.50 12 Letterhead Excelsior 68.50 31 Note Imagine 62.50 11 |
|
|
|
|
|
|
while ((!read1.fail()) && (!read2.fail())) statement.while ((!read1.fail()) && (!read2.fail())) to emulate your previous suggestions. |
|
Carl Edward Letterhead Elegant 96.00 8 Fred Letterhead Elegant 96.00 10 Dave Note Imagine 62.50 5 Garrett Letterhead Excelsior 68.50 3 Jim Note Imagine 62.50 12 Karen Note Imagine 62.50 11 Note Imagine 62.50 20 John Letterhead Excelsior 68.50 31 Kristen Letterhead Excelsior 68.50 55 Larry Note Imagine 62.50 48 |
endl;, all of the pieces of data that meet that condition are printed out to a single, gigantic line. My while (!read1.fail()) statement prints out nicely. getline(read1, line1); This reads the entire line (up to the next '\n' or end of file) into the string line1.read1 >> line1;. This reads just a single word at a time, and stops at the next space, or '\n', or end of file. That is the cause of your problem.getline(), but somewhere along the line things seem to get mixed up. I'm not sure what happened, but I hope you are back on track now.