主题:请问这个程序有什么问题
#include<iostream>
using namespace std;
enum color
{red='R',black='B',white='W',green='G'};
void printcolor(color);
int main()
{
color thiscolor;
cout<<"enter R B W G reprezenteach colors"<<endl;
cin>>thiscolor;
printcolor(thiscolor);
return 0;
}
void printcolor(color thiscolor)
{
switch(thiscolor)
case red:
cout<<"red"<<endl;
break;
case black:
cout<<"black"<<endl;
break;
case white:
cout<<"white"<<endl;
break;
case green:
cout<<"green"<<endl;
break;
default:cout<<"error";
break;
return;
}
using namespace std;
enum color
{red='R',black='B',white='W',green='G'};
void printcolor(color);
int main()
{
color thiscolor;
cout<<"enter R B W G reprezenteach colors"<<endl;
cin>>thiscolor;
printcolor(thiscolor);
return 0;
}
void printcolor(color thiscolor)
{
switch(thiscolor)
case red:
cout<<"red"<<endl;
break;
case black:
cout<<"black"<<endl;
break;
case white:
cout<<"white"<<endl;
break;
case green:
cout<<"green"<<endl;
break;
default:cout<<"error";
break;
return;
}