C++之enum{枚举类型}用法
using namespace std;
#include <iostream>
enum cattle{
red,green=10,blue
}bull;
bull = blue;
int main(){
cout<<bull<<endl
<<red<<endl;
return 0;
}
输出:11
0
cattle 是enum类型的名字,bull是它的变量,默认值从0起,如果前一个元素赋值之后,其后面的元素值则依此递增,前面元素不变还是默认值