what is wrong with my enumerator code.

0 votes
asked Aug 21, 2019 by Ali Haider
#include<iostream>
using namespace std;
int main()
{

enum class week {monday, tuesday, wednesday, thursday, friday, saturday, sunday};
    enum class running_day{wednesday, sunday};
week day1=week::monday;
week day2=week::tuesday;
week day3=week::wednesday;
week day4=week::thursday;
week day5=week::friday;
week day6=week::saturday;
week day7=week::sunday;
cout<<"Monday is the day "<<day1<<endl;
cout<<"Tuesday is the day "<<day2<<endl;
cout<<"Wednesday is the day "<<day3<<endl;
cout<<"Thursday is the day "<<day4<<endl;
cout<<"Friday is the day "<<day5<<endl;
cout<<"Saturday is the day "<<day6<<endl;
cout<<"Sunday is the day "<<day7<<endl;  

this is an scoped enumeration. i tried the unscopped too. neither worked.

1 Answer

0 votes
answered Aug 31, 2019 by anonymous
hi

delete "class" after enum and run
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...