Thread: Loop Question

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    84

    Loop Question

    I have two for loops

    for(int i = 0; i < n; i++)
    for(int j=0; j<n; j++) Magic[i][j] = 0;
    Magic[0][(n-1)/2]=1;//Middle of first row
    //(i,j) is the current position.

    Iis there a way to do two four loops with a while or dowhile or any other loop function?

  2. #2
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    Posts
    330
    Code:
    register int a, b, c;
    for (a = 0; a < 2000; ++a) {
         for (b = 0; b < 100; ++b) {
              c ^= c;
              while (c != 100) {
                   ++c; 
              }
         }
    }
    very possible...

  3. #3
    Unregistered
    Guest
    what does this do?

    c ^= c;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. For loop question
    By JuzMe in forum C++ Programming
    Replies: 11
    Last Post: 04-20-2009, 08:39 AM
  2. Loop question
    By kwood965 in forum C Programming
    Replies: 6
    Last Post: 10-29-2008, 11:12 PM
  3. simple for loop function question
    By felicityxiv in forum C Programming
    Replies: 7
    Last Post: 05-06-2006, 11:43 PM
  4. Please don't laugh...SIMPLE loop question!
    By the_lumin8or in forum C++ Programming
    Replies: 5
    Last Post: 03-31-2006, 01:08 PM
  5. while loop question
    By rayrayj52 in forum C++ Programming
    Replies: 2
    Last Post: 10-19-2004, 05:13 PM