error use of enum without previous declaration?

c++

Solution

You're using `enum` incorrectly. Your parentheses should be braces:

enum Days {zo,ma,di,wo,do,vr,za};

Now `zo` will be equal to 0, since you didn't explicitly define a value, and each thereafter will be one more than the last.

Also notice (easily, due to syntax highlighting) that `do` conflicts with the `do` keyword reserved for `do...while` statements.

Problem

I'm learning C++ from a book and the following example doesn't work in codeblocks. My compiler gives an error: use of enum `'Days'` without previous declaration Can someone enlight me here? ``` #include <iostream> using namespace std; int main() // main routine { int a; enum Days (zo,ma,di,wo,do,vr,za); // <error here> : use of enum 'Days' without previous declaration Days today; today = ma; if (today == zo || today == za) cout << "weekend \n" else cout << "ohno workday \n"; return 0; } ```

Original source