Computer Science, asked by prnce1000, 11 months ago

Consider the following enum in c++ ,what will be the value of monday and Wednesday enum days sunday=6

Answers

Answered by gauravarduino
39

Explanation:

Example: we can define the above enumeration using the following ... enum Day { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }; ... Value and variables of enum type can be ...

Answered by amikkr
0

After considering the enum in c++ the value of Monday and Wednesday can be 0 and 2.

  • In C, an enum is a list of constants. It's what we use to provide meaningful names to the many options. The developer usually does not need to know the specific values behind these names.
  • If the c.ode be  enum{Monday, Tuesday, Wednsday, Thursday, Friday, Saturday, Sunday} to-day, to-morrow; to-day = Friday; to-morrow = Saturday; if(to-day == Saturday || to-day == Sunday) printf("Ah rest day!"); else  printf("Oh no we need to work."); , in that case Monday = 0, Tuesday = Monday+1=1, Wednesday =1+1= 2. . . Sunday = 6.
  • Hence, the value of Monday is 0 and Wednesday is 2.

#SPJ2

Similar questions