Yeah, you'll have to read all of the data in, then sort it. At the moment, you're just comparing adjacent lines like BAMF said.
As a general note, you'll want to be checking EOF before you start reading lines, to stop it going off the end.
Quote:
inFile.getline(input1, 101);
inFile2.getline(input2, 101);
while(!inFile.eof() || !inFile2.eof())
{
...
inFile.getline(input1, 101);
inFile2.getline(input2, 101);
}
|
should be
while(!inFile.eof() || !inFile2.eof())
{
inFile.getline(input1, 101);
inFile2.getline(input2, 101);
...
}
or something.
__________________
"Oh, irony! Oh, no, no, we don't get that here. See, uh, people ski topless here while smoking dope, so irony's not really a high priority. We haven't had any irony here since about, uh, '83 when I was the only practitioner of it, and I stopped because I was tired of being stared at."
Omnia mutantu, nos et mutamur in illis.
All things change, and we change with them.
- Neil Gaiman, Marvel 1602
|