|
-
December 8th, 2007, 03:41 PM
#1
Help coming up with stupid loop.
I am trying to come up with a loop to overlap a 4X4 "box" array onto a a jar of larger size starting at row = 0 and col = 3 on the jar. Here is my last attempt, but I can't get it (firstcol=3/firstrow=0):
Code:
for(int m=0;m<4;m++)
{
for(int n=0;n<4;n++)
for(int x=firstRow;x<firstRow+4;x++)
//for(int y=firstCol;y<firstCol+4;y++)
{
jar[x][m] = box[n][m];
}
}
can anyone suggest a solution?--that would be MUCH appreciated.
-
December 8th, 2007, 04:15 PM
#2
Re: Help coming up with stupid loop.
Hi,
You want to copy all of 'box' into 'jar', right?
I think you just need the first 2 loops as you have them, and inside that put something like:
jar[n + firstCol][m + firstRow] = box[n][m];
Or maybe I misunderstood what you want to do.
Cheers,
Alan
-
December 8th, 2007, 04:36 PM
#3
Re: Help coming up with stupid loop.
-
December 8th, 2007, 11:03 PM
#4
Re: Help coming up with stupid loop.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|