枚举列子,执行得不到结果,帮忙看看,指出哪里错了,改的地方注释一下哈
#include<stdio.h>
void main()
{
enum color {red,yellow,blue,white,black};
enum color i,j,k,pri;
int loop;
int n=0;
for(i=red;i<=black;i+1)
{
for(j=red;j<=black;j+1)
{
if(i!=j)
{
for(k=red;k<=black;k+1)
if((k!=i)&&(k!=j))
{
n=n+1;
printf("%-4d",n);
for(loop=1;loop<=3;loop++)
{
switch (loop)
{
case 1:pri=i;break;
case 2:pri=j;break;
case 3:pri=k;break;
}
switch (pri)
{
case red: printf("%-10s","red");break;
case yellow: printf("%-10s","yellow");break;
case blue: printf("%-10s","blue");break;
case white: printf("%-10s","white");break;
case black: printf("%-10s","blak");break;
default:break;
}
}
printf("\n");
}
}
}
}
printf("\ntotale : %blackd\n",n);
}