1. ## I have a 2 easy question about some homework?

Hello,
i am having a debate with a fello college about this one. Can someone set the record dtraight once and for all with this easy queastion?

enum color {red, yellow, green, blue}

QUESTION1:
What is the value of the expression(enum color) ((int)red +2)?
a. 0
b. 1
c. 2
d. green

enum cday {sun, mon,tue,wen,thu,fri,sat}

QUESTION2:
What is the value of the expression(enum day) ((int)thu + 5)% 7)?

a. 2
b. sun
c. mon
d. tue

Later Gator 12%43!&
-c-c-out

2. ## Re: I have a 2 easy question about some homework?

>QUESTION1
red is 0, therefore the calculation is 0+2 = 2.

>QUESTION2
thur is 4 (or it would be if you spelt it correctly ), therefore the calc is ((4 + 5 +2)% 7) = 4
Also, because you added 7 (5+2) then mod'ed by 7, you'll always end up with what you started.

That's what I think, at this early hour of the morning

How did you get to mon for q2?

3. ## How did you get to mon for q2?

Thats simple hammer,
I msispleed the expression.
I meant to say: ((int)(thu + 5)%7)
Now whatcha think all the ways from UK.

4. >((int)(thu + 5)%7)
thu is still 4, so we have
>(4 + 5)%7
which is
>9%7
equals 2.