I have a program for a 5-way sort merge. I can get the program to read from the original file of 1,000,000 records and write them to 5 tempoary files (File0 thru File4). Then, I am suppose to close the temp files (Files 0 - 4) and open them as input, and open 5 more temp files (File 5 thru File 9). I cannot get the Files 0 - 4 to print to Files 5 - 9. Here is part of my code, as it is a little long. How do you get the % operator to print to Files 5 - 9? It works fine for Files 0 - 4.
InputCounter = 0;
OutputCounter = 5;
int NumOfPasses = 0;
FileSize = ClumpSize * NumOfFiles;
while (NumOfFiles < 5)
{
while (LoopCount < FileSize)
{
for (j = 0; j < ClumpSize; j++)
{
F[InputCounter%5] >> Number;
ClumpArray[j] = Number;
} // end for
QuickSort(ClumpArray, 0, 999);
for (i = 0; i < ClumpSize; i++)
{
F[InputCounter%5] << setprecision(15);
F[InputCounter%5] << ClumpArray[i] << '\n';
} // end for
InputCounter ++;
OutputCounter++;
} // end while
NumOfFiles ++;
LoopCount++;
} // end while
Thanks for any input you may have.