Enum days using if/else statement

#include "stdafx.h"
#include "iostream"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
       enum Days{Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday};
     Days TheDay;
        int i;
        cout << "Please enter the day of the week  (0 to 6):" << "\n";
        cin >> i;
        TheDay = Days(i);
        if (TheDay == Sunday || TheDay == Saturday)
              cout<<"Hurray it is the weekend"<< "\n";
        else
       cout<<"Curses still at work" << "\n";
        system("pause");
       return 0;
}



Share on Google Plus