2013-11-08 00:08:18 UTC
The program:
#include
enum Color
{
COLOR_BLACK,
COLOR_WHITE,
COLOR_RED,
COLOR_BLUE,
COLOR_GREEN,
};
void PrintColor(Color eColor)
{
using namespace std;
switch(eColor)
{
case COLOR_BLACK:
cout << "Black" << endl;
break;
case COLOR_WHITE:
cout << "White" << endl;
break;
case COLOR_RED:
cout << "Red" << endl;
break;
case COLOR_BLUE:
cout << "Blue" << endl;
break;
case COLOR_GREEN:
cout << "Green" << endl;
break;
}
}
int main()
{
using namespace std;
cout << "Choose a color!" << endl << endl;
cout << "Black, White, Red, Blue or Green" << endl << endl;
cin >> eColor;
PrintColor(eColor);
return 0;
}
Unfortunately it's giving me the error: eColor was not declared in this scope (error in line 40: 'cin >> eColor'). If anyone knows how to solve this problem, please help me, and IF POSSIBLE, could you maybe also give me a link to a tutorial where I can start learning programming to create windows and simple games etc. I want to start looking into this as I set goals for myself and really want to look at it. Thank you for the help :D.