include<iostream>
using namespace std;
void main()
{
enum type1{hello,OK};
type1 m;
m=hello;
cout<<"m is :"<<m<<endl;
m=OK;
cout<<"m is :"<<m<<endl;
int p=1;
static_cast<type1>(p); //将数字转换成枚举类型
cout<<p<<endl;
}
C++枚举
最新推荐文章于 2023-12-05 16:57:47 发布