You are on page 1of 1

Write an enum type for weekday – Sunday, Monday …

Define two variables of that enum type


Read two integer variables from user.
Print out the day of the week for both variables (string should be
printed and not 0 or 1 …)
Compare the two variables and print whether they are equal or not.

enum weekday
{
sunday=1, monday, tuesday, wednesday,
thursday, friday, saturday
};
void print_day(enum weekday w)
{
}

int main()
{
enum weekday day1, day2;
int n1, n2;
cout << "enter 2 days (in number):\n";
cin >> n1 >> n2;

// n1 & n2 should be between 1 and 7


// check condition using assertions
print_day(day1); print_day(day2);

if(day1==day2)
cout<<"\nThe days are the same\n\n";
else
cout<<"\nThe days are not the same\n\n";
}

You might also like