Page 1 of 1

define# switch case

PostPosted: Sat Mar 17, 2007 9:12 am
by jazz_e_bob
I've defined some stuff in global code:

Code: Select all
#define E 0;
#define N 90;
#define W 180;
#define S 270;


but when I try the code...

Code: Select all
switch ( creator.myDirection )
{
    case E: xvelocity = mySpeed; break;
    case N: yvelocity = -mySpeed; break;
    case W: xvelocity = -mySpeed; break;
    case S: yvelocity = mySpeed; break;
}


The compiler expects a ":" on the case lines.

Any feedback appreciated.

PostPosted: Sat Mar 17, 2007 2:01 pm
by makslane
Remove the ; in the defines.

PostPosted: Sat Mar 17, 2007 6:54 pm
by jazz_e_bob
:oops:

Thanks mate.