My gigantic while loop works great except that it repeats the very last line in the output. Any ideas on where the error might be would be appreciated.
Here is a piece of the loop:
Code:
while (!fin.eof()) {
fin >> ch1;
if ((ch1 == 'M') || (ch1 == 'F')) {
fin >> ch2;
if (ch1 == 'M') {
males++;
} else {
females++;
if (ch2 == 'A') {
fin >> age;
ageAccum = age + ageAccum;
count++;
fin >> dummych;
fin >> weight;
weightAccum = weight + weightAccum;
count2++;
newlog(ch1, age, weight, fout);
} else {
fin >> weight;
weightAccum = weight + weightAccum;
count2++;
fin >> dummych;
fin >> age;
ageAccum = age + ageAccum;
count++;
newlog(ch1, age, weight, fout);
}
}
If you need the whole thing, let me know.