c++枚举 这个总是提示'enum main::color' does not define this operator or a conversion to a type acce

问题描述:

c++枚举 这个总是提示'enum main::color' does not define this operator or a conversion to a type acce
#include
void main()
{
enum color{red,yellow,blue,white,black};
enum color i,j,k,pri;
int n,loop;
n=0;
for(i=red;i

错误提示是说你没有为enum color枚举类型定义++操作,其实,把i,j,k都定义为int类型就行了,再赋值给pri的时候,使用强制转换程序如下:#includevoid main() {enum color{red,yellow,blue,white,black};enum color pri;i...