.

Edited 5 Years Ago by ksm092: n/a

Comments
Don't delete your post. Leave a message in the old post so we know what's going on.

in for loop if one the values are initialised they cant get the values back. for every loop it will continiously increments the values. if you use the statement continue it sends the control back to the for loop. there it starts the excecution by checking the condition. it wont initialize values again.

if you want the initial values i,e x=1 and y=0 after continue just place x=1; and y=0; before placing continue statement in if statement

Sorry about deleting my internet is screwed up and wanted to redo my question.
Ive rewritten my code:

for(int x=1, y=0; y < 5, x<14; x++, y++)
  {
    array[x][y] = duties[y];
    if (y == 4)
      {
      y = 0;
      continue;
      }
  }

Im not entirely sure what I can do to fix the resulting output. As it seems after the continue is utilized, y goes to y=1 instead of y=0.

there in for loop. it increments the value and then checks for the condition. if you want y=0; after executing the contineu just give y=-1;

hmm yea that fixes a bit of it but there still seems to be some very funky glitches in the output of the array...

This is what I have done so far to try and fix it.

for(int x=1, y=0; y < 5, x<14; x++, y++)
  {
    array[x][y] = duties[y];
    if (y == 4)
      {
      y = -1;
      x--;
      continue;
      }
  }

This is the output code:

for(int y=0; y<5; y++)
  {
  for(int x=0; x<15; x++)
    {
    cout<<array[x][y];
    cout << '\t';
    }
  cout<<endl;
  }
}

This is the actual cout:

Sam	dishes					dishes					dishes					dishes			
Chinky		toilet					toilet					toilet						
Derrick			lounge 				lounge 				lounge 				
Timmy				rubbish				rubbish				rubbish			
Bobbie					vacuum				vacuum				vacuum

The first dishes to vacuum is what its supposed to look like and its supposed to just kind of repeat like that.

Guys, making post after post after post is not the correct way to deal with a forum. Think about your post before you type it in. If you need to add something, EDIT the post, don't just make another post.

This article has been dead for over six months. Start a new discussion instead.