B
Blankdraw
I can't get this nested loop to break the outer loop at the
5th data value so control can proceed to the next array col
and continue pigeon-holing the next 5 in its own column.
Why can I not get this nested loop to make sense?
This is the last holdup to completion of my silly project.
Explaining it from the inside - out, I want to fill a
120-col X 40-row array with data from a file containing
120 data records of 5 2-digit entries per rec.
A 52-iteration loop needs to go down one column at a time,
copying the previous value and incrementing the ones which
which are as far down the array as the data values 'say' so.
(rows are numbered 1-40 & data values are between 1 and 40.)
Help on this is desperately needed - my mind may not be logical
enough for this algorithm - mental block or something.
No need to comment on exact loop quantities, if I garbled any.
for (cycle = 1; cycle < 121; cycle++) /* 120 data recs */
{
fscanf(fileptr, "%i", &n); /* <---get next data value */
for (row = 0; row < 40; row++)
{
current[row][col] = current[row][col - 1];
if (n == row)
{
temp = current[row][col] + 1;
current[row][col] = temp; /* current[r][c]++ ??? */
}
}
EOL = floor(cycle / 5);
if ( EOL == (cycle / 5 ) ) { /* cycles 1 to 5 goto col 1 */
col++; /* note: cycle #0/5 -> NoGo */
/* next 5 (#6 - #10) goto col 2 */
}
}
5th data value so control can proceed to the next array col
and continue pigeon-holing the next 5 in its own column.
Why can I not get this nested loop to make sense?
This is the last holdup to completion of my silly project.
Explaining it from the inside - out, I want to fill a
120-col X 40-row array with data from a file containing
120 data records of 5 2-digit entries per rec.
A 52-iteration loop needs to go down one column at a time,
copying the previous value and incrementing the ones which
which are as far down the array as the data values 'say' so.
(rows are numbered 1-40 & data values are between 1 and 40.)
Help on this is desperately needed - my mind may not be logical
enough for this algorithm - mental block or something.
No need to comment on exact loop quantities, if I garbled any.
for (cycle = 1; cycle < 121; cycle++) /* 120 data recs */
{
fscanf(fileptr, "%i", &n); /* <---get next data value */
for (row = 0; row < 40; row++)
{
current[row][col] = current[row][col - 1];
if (n == row)
{
temp = current[row][col] + 1;
current[row][col] = temp; /* current[r][c]++ ??? */
}
}
EOL = floor(cycle / 5);
if ( EOL == (cycle / 5 ) ) { /* cycles 1 to 5 goto col 1 */
col++; /* note: cycle #0/5 -> NoGo */
/* next 5 (#6 - #10) goto col 2 */
}
}