c++ 枚举简单举例




#include <iostream>
enum  Enumeration{
 VAL1,
 VAL2,
 VAL3=100,
 VAL4
};


int main()
{
    using namespace std;
    cout << "HelloWorld
";
    cout << VAL1 << endl;
    cout << VAL4 << endl;
    cout << "
";
    return 0;
}

输出:

HelloWorld
0
101




原文地址:https://www.cnblogs.com/wangjiale1024/p/10289764.html