Thread: !urgent need help with writiing loop

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    44

    !urgent need help with writiing loop

    say i have an array of size 4

    and this is what i want to to...
    tmp[0][0].id is initialized to [0].id

    if tmp[0][0].id = a[1].id
    tmp[0][1].id = a[1].id
    if it isnt true go to next statement
    tmp[1][0].id = a[1].id
    then next loop

    if tmp[0][0].id = a[2].id
    tmp[0][2].id = a[2].id
    if it isnt true
    if tmp[1][0].id = a[2].id
    tmp[1][1].id = a[2].id
    if it isnt true
    tmp[2][0].id = a[2].id
    then next loop

    if tmp[0][0].id = a[3].id
    tmp[0][3].id = a[3].id
    if it isnt true
    if tmp[1][0].id = a[3].id
    tmp[1][2].id = a[3].id
    if it isnt true
    if tmp[2][0].id = a[3].id
    tmp[2][1].id = a[3].id
    if it isnt true
    tmp[3][0].id = a[3].id

    how would i go about doing this for an array with size N?

    this is the idea for the code i have so far... wrote on paper syntax is not correct
    y is the size of the array
    Code:
    int z = 1;
    for(int x=0;x<y;x++)
    {
         for(z;z<y;z++)
         {
            if(tmp[x][x].id = a[z].id;
             tmp[x][z].id = a[z].id;
          }
        else
        tmp[z][x].id = a[z].id
        }
    }
    Last edited by loso44x; 11-16-2005 at 06:40 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My loop within loop won't work
    By Ayreon in forum C Programming
    Replies: 3
    Last Post: 03-18-2009, 10:44 AM
  2. loop in a linked linked lists
    By kris.c in forum C Programming
    Replies: 6
    Last Post: 08-26-2006, 12:38 PM
  3. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 12:13 AM
  4. A somewhat bizzare problem!!! - WHILE LOOP
    By bobthebullet990 in forum C Programming
    Replies: 3
    Last Post: 03-31-2006, 07:19 AM
  5. when a while loop will stop ?
    By blue_gene in forum C Programming
    Replies: 13
    Last Post: 04-20-2004, 03:45 PM