对枚举进行字符赋值,需要进行强制类型转换之后,才能得到想要的值,如下
typedef enum data
{
DIRECTION_X = 'X',
DIRECTION_Y = 'Y',
DIRECTION_Z = 'Z',
DIRECTION_T = 'T'
}NumData;
int main()
{
NumData numdata = DIRECTION_Y;
count <<"num is=="<<static_cast<char>(numdata )<<endl;
return 0;
}