枚举可以直接赋值给int

 #include <iostream>
using namespace std;
void main()
{
 enum
 {
  test1,
  test2,
  test3,
  test4
 };
 int i=test4;
 cout<<i<<endl;
 getchar();
}
posted @ 2011-10-20 10:56  byfei  阅读(936)  评论(0编辑  收藏  举报