#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;
}
- Include the necessary header file for input and output stream operations.
- Declare the namespace
std
to use its members without qualifying them with their namespace. - 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). - Begin the
main()
function. - Declare a variable
today
of type Day
and assign it the value Wednesday
. - Declare an integer variable
dayValue
. - Assign the value of
today
(which is Wednesday
, represented as 2) to dayValue
. - Output the value of
today
to the console. - Output the value of
dayValue
to the console. - End the program execution by returning 0, indicating successful completion.