C++ enumaration
- by asli
Hi,my question is about enumaration,my codes are :
#include<iostream>
using namespace std;
int main()
{
enum bolumler{programcilik,donanim,muhasebe,motor,buro} bolum;
bolum = donanim;
cout<<bolum<<endl;
bolum+=2; /* bolum=motor */
cout<<bolum;
return 0;
}
The output should be
1
3
but according to these codes the error is:
error C2676: binary '+=' : 'enum main::bolumler' does not define this operator or a conversion to a type acceptable to the predefined operator
Error executing cl.exe.
111.obj - 1 error(s), 0 warning(s)
Can you help me ?The other question is what can I do if I want to see the output like that "muhasebe"?