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
  • Question 1 Given the declarations: #include <stdio.h> struct STRUCTURE { int aa; char bb[20]; } enum...

    Question 1 Given the declarations: #include <stdio.h> struct STRUCTURE { int aa; char bb[20]; } enum Numbers { zero, one, two, three } typedef struct STRUCTURE STR; typedef enum Numbers NB; STR st1, st2; NB value1, value2; check the validity of the following assignments: A) Valid B) Not valid value1 = four; value2 = three; printf (“st1= %d”, st1); st2.aa = two; strcpy(st2.bb,"Quiz4");

  • how to check enums in C let us say I have the following enum: enum days{...

    how to check enums in C let us say I have the following enum: enum days{ MONDAY, SUNDAY, THURSDAY } ; I want to check if a struct that contains this enum has a valid value for example typedef struct { int date; enum day name; } complete_date; so now I want to check if a complete_date has a valid enum it can only be valid if it is MONDAY,SUNDAY, OR THURSDAY. i want to assert that becuase if it...

  • c++ What is the value of "Wed" given the following: enum DAYS { Sun, Mon =...

    c++ What is the value of "Wed" given the following: enum DAYS { Sun, Mon = 0, Tue = 4, Wed, Thu = 7, Fri, Sat } Select one: a. 10 b. -1 c. 5 d. 6 What returns the number of bytes in a data type or variable? Select one: a. bytesize b. length c. sizeof d. bytes

  • Given the following enumeration, what is the output from the printf(): enum day { sun, mon,...

    Given the following enumeration, what is the output from the printf(): enum day { sun, mon, tue, wed, thu, fri, sat}; enum day d; d = mon; prrintf("%d\n", d); a. mon b. 1 c. MON d. 0

  • The amount of rainfall yesterday was 3 in. and the amount today is 2. You are...

    The amount of rainfall yesterday was 3 in. and the amount today is 2. You are to use simple exponential smoothing method (and the data from today and yesterday) to make forecasts. Using a smoothing parameter alpha equals 0.5, what is your forecast for the amount of rainfall tomorrow? Round your answer to two decimal places.

  • Consider the following events: R - it will rain tomorrow (same as on any given day...

    Consider the following events: R - it will rain tomorrow (same as on any given day of the year) Rc - it will not rain tomorrow F - tomorow's forcast says it will rain Here is what we know from the past: P(R) = 0.25 (25% of the days were rainy) P( F | R ) = 0.85    (85% of the rainy days were corectly predicted) P( F | Rc ) = 0.20   (20% of the not rainy days had...

  • Suppose the weather of the day for the future days (starting from tomorrow) is good (including...

    Suppose the weather of the day for the future days (starting from tomorrow) is good (including sunny, cloudy and etc) has probability 1/3 and the weather of the day is bad (including raining, foggy, windy and etc.) has probability 2/3. Starting from tomorrow, compute the expectation of number of days until there are 7 consecutive days of good weather.

  • ***C++ Only*** Create an enum for the days of the week, starting with Monday. Print your...

    ***C++ Only*** Create an enum for the days of the week, starting with Monday. Print your enums, which includes the day of the week and it's numeric value. Create a 2nd enum for cars. Use Honda, Toyota, Subaru, and Saab. Print as before. ***C++ Only***

  • There is a 55% probability that Ella is happy tomorrow if she's happy today, and there...

    There is a 55% probability that Ella is happy tomorrow if she's happy today, and there is a 90% probability that she's sad tomorrow if she's sad today. We know that seven days ago, Ella was sad. What is the probability that Ella was happy anytime in the last seven days?

  • In Java You are to write a program that determines the day of the week for...

    In Java You are to write a program that determines the day of the week for New Year's Day in the year 3000. To do this, you must create your own date class (MyDate) and use the following interface and main program: /** Interface for Date objects to be used by the Year3000 driver program. @author Jon Sorenson */ public interface DateInterface { /** @return the day of the month (1-31) */ public int getDay(); /** @return the day of...

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