enmu to normal

Thank you for helping:
Last edited on
Firstly, an enumeration is "normal C++". I think what you teacher wants is to convert that into a list of constants rather than letting the anonymous enumeration do that work for you. You'll need to make them const ints and assign them some arbitrary different values. If you have problems doing this, you should post the relevant code and the errors.
your enum is anonym( no name) also just in case DIGIT by DIGIT=0 , also enum is not necessarily an int by the way. use something lke that instead

enum InputType : int {DIGIT=0, ....};

then u have a method that takes as parameter an INputType type .
closed account (E0p9LyTq)
Chubby wrote:
how can i change to normal. enmu to change normal c++. Like int DIGIT. Because my teacher she wont accept that enmu. she told to change to int DIGIT.


typedef int DIGIT; or using DIGIT = int;

If you have to use an enumerated constant (enum) then you need to specify a type name, such as:

enum type_name {DIGIT,LETTER, IDENT, INT_LIT, ERROR, SPACE, STOP, PLUS_CODE};

Then you declare a variable using that type name, same as if you were using one of the built-in types such as int or double: type_name var = LETTER;

And if you need to use an enum in a control statement, if for example: if (var == ERROR)
enum {DIGIT,LETTER, IDENT, INT_LIT, ERROR, SPACE, STOP, PLUS_CODE};

She want to PLUS_CODE to turn in array.

for example,

If I enter "IF" it should display if is keyword.

i know how to declare array but how do you declare array in enum?
Topic archived. No new replies allowed.