You may be confusing yourself because you are using
the same name for both the numeric (int) color value
and the alpha (string) name of the color. If you think
about the code you have written such as this:
cin >> color;
if (color == 1)
{
cout << blue;
color = 1;
};
it should be apparent that something isn't quite right.
If color is equal to 1, what sense does it make to set
it to 1 - the value that it already holds? As Viorel_
suggested, you are not keeping distinct the places
that you want to use a number to represent the color
and the places where you want the name of the color.
Wayne
8 people are following this question.