So I'm given an int that is from 0 to 2. I would like to print out a color based on the int. Suppose the int is 1, it prints out "Blue". I need to go from the int to checking which enum it is, to then printing out the color(not in caps). I tried casting the int but it doesnt work. The int doesnt cast to anything, it stays an int
here are the snippets.
enum Color
{
COLOR_RED,
COLOR_BLUE,
COLOR_GREEN,
};
int index = 1;
Color c = static_cast<Color>(index);
cout << c;