Question

Given the declarations enum Days {YESTERDAY, TODAY, TOMORROW}; Days day = TODAY; what is the value...

Given the declarations

enum Days {YESTERDAY, TODAY, TOMORROW};
Days day = TODAY;

what is the value of the expression int(day) ?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer: 1

In the first line we have declared an enumeration of the name 'Days' which has three values.

In the second line we create an object/variable (day) of enum and declare it with TODAY. What happens here is the index value of TODAY is assigned to the variable 'day'. i.e. 1 is assigned to day.

So the value of int(day) = 1

main.cpp 2 #include <iostream> 4 using namespace std; 6 int main() -{ enum Days {YESTERDAY, TODAY, TOMORROW} ; Days day = TOD

Add a comment
Know the answer?
Add Answer to:
Given the declarations enum Days {YESTERDAY, TODAY, TOMORROW}; Days day = TODAY; what is the value...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT