On Mon, Mar 2, 2009 at 11: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?

#include <iostream>
int main(void){
        int x, y;
        for (int i = 0; i < 12; i++){
                x = 0;
                y = 0;
                if (i >= 4 && i < 8){
                x = 100;
                }
                if (i >= 8 ){
                x = 200;
                }
        }
        std::cout << "x=" << x << " y=" << y << std::endl;
}

Works as expected here - was that a direct copy/paste of your test code?

-- 
PJH

http://shabbleland.myminicity.com/ind
http://www.chavgangs.com/register.php?referer=9375

Reply via email to