1.
What is the output of the code below?
enum Month { JAN = 1, FEB, MAR, APR,
MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC };
int main() {
Month m1 = JUL;
Month m2 = NOV;
cout << m1 << " " << m2 << endl;
}
- JULY NOVEMBER
- What are the actual values of
JUL
andNOV
? - JUL NOV
- What do the values of enumerated types map to?
- 7 11
- Since we defined
JAN
to start at 1,JUL
andNOV
map to 7 and 11. - 6 10
- Take a closer look at our enumerated type definition.