c语言,我和书上的代码是一样的呀,为什么出错了,不定义该运算符或到定义预定义运算符可接收的类型的
转换是什么意思#include<stdio.h>intmain(){enumColor{red,yellow,blue,white,black};enumColori,j...
转换是什么意思
#include<stdio.h>
int main()
{enum Color{red,yellow,blue,white,black};
enum Color i,j,k,pri;
int n=0,loop;
for(i=red;i<=black;i++)
for(j=red;j<=black;j++)
if(i!=j)
{
for(k=red;k<=black;k++)
if((k!=i)&&(k!=j))
{
n=n+1;
printf("%d",n);
for(loop=1;loop<3;loop++)
{
switch(loop)
{
case 1:pri=i;break;
case 2:pri=j;break;
case 3:pri=k;break;
default:break;
}
switch(pri)
{
case red:printf("%10d","red");break;
case yellow:printf("%10d","yellow");break;
case blue:printf("%10d","blue");break;
case white:printf("%10d","white");break;
case black:printf("10d","black");break;
default:break;
}
}
printf("\n");
}
}
printf("\ntotal:%5d\n",n);
return 0;
} 展开
#include<stdio.h>
int main()
{enum Color{red,yellow,blue,white,black};
enum Color i,j,k,pri;
int n=0,loop;
for(i=red;i<=black;i++)
for(j=red;j<=black;j++)
if(i!=j)
{
for(k=red;k<=black;k++)
if((k!=i)&&(k!=j))
{
n=n+1;
printf("%d",n);
for(loop=1;loop<3;loop++)
{
switch(loop)
{
case 1:pri=i;break;
case 2:pri=j;break;
case 3:pri=k;break;
default:break;
}
switch(pri)
{
case red:printf("%10d","red");break;
case yellow:printf("%10d","yellow");break;
case blue:printf("%10d","blue");break;
case white:printf("%10d","white");break;
case black:printf("10d","black");break;
default:break;
}
}
printf("\n");
}
}
printf("\ntotal:%5d\n",n);
return 0;
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询