'I have used enum in my code and it is crashing [closed]
I am using enum in the below code and using operator overloading but it is crashing. Could anyone explain why?
#include<iostream>
using namespace std;
enum E{M, T= 3, W, Th, F, Sa, Su};
E operator+(const E &a, const E &b){
unsigned int ea = a, eb = b;
unsigned int ec = (a+b)%7;
return E(ec);
}
int main(){
E a = M, b = F;
cout<<a<<endl;
cout<<b<<endl;
E day = a+b;
//cout<<int(day)<<endl;
return 0;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
