get value of enum cpp

#include <iostream>
using namespace std;

enum Day { Monday, Tuesday, Wednesday, Thursday, Friday };

int main() {
    Day today = Wednesday;
    int dayValue = today;

    cout << "Value of today: " << today << endl;
    cout << "Value of dayValue: " << dayValue << endl;

    return 0;
}
  1. Include the necessary header file for input and output stream operations.
  2. Declare the namespace std to use its members without qualifying them with their namespace.
  3. Define an enumeration type Day that includes the weekdays Monday, Tuesday, Wednesday, Thursday, and Friday, with default integer values assigned to each (0, 1, 2, 3, 4 respectively).
  4. Begin the main() function.
  5. Declare a variable today of type Day and assign it the value Wednesday.
  6. Declare an integer variable dayValue.
  7. Assign the value of today (which is Wednesday, represented as 2) to dayValue.
  8. Output the value of today to the console.
  9. Output the value of dayValue to the console.
  10. End the program execution by returning 0, indicating successful completion.