On Mon, Mar 2, 2009 at 6:03 PM, Michael Sullivan <[email protected]> wrote:

> if I step through it with F10 it works correctly, but if I don't, it
> doesn't, and at the end of the run x is still 0.  Is this a problem with
> VC++ or a problem with my code.  I'm trying to figure out a formula for
> displaying sprites in 3 columns of four rows each.  Does anyone know a
> formula for that that doesn't involve the above method?

If you're trying to generate (x,y) coordinates for screen locations,
you'll want to go with something like:

for(i = 0; i < 4; i++) {
  y = i* 100;

  for(j = 0; j < 3; j++) {

    x = j * 100;

    printf ("(%d,%d)\n", x, y);

  }
}

Which gives:

(0,0)
(100,0)
(200,0)
(0,100)
(100,100)
(200,100)
(0,200)
(100,200)
(200,200)
(0,300)
(100,300)
(200,300)

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to