枚举可以直接赋值给int #include <iostream> using namespace std; void main() { enum { test1, test2, test3, test4 }; int i=test4; cout<<i<<endl; getchar(); }