主题:看看这程序出错在哪??
看看这程序出错在哪??
#include<iostream>
using namespace std;
void mian()
{
enum color{red,yellow,bule,white,black};
enum color pri;
int loop,n,i,j,k;
n=0;
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;
cout.width(4);
for(loop=1;loop<=3;loop++)
{
switch(loop)
{
case 1:pri=(enum color)i;
break;
case 2:pri=(enum color)j;
break;
case 3:pri=(enum color)k;
break;
default:break;
}
switch(pri)
{
case red:cout<<" red";
break;
case yellow:cout<<" yellow";
break;
case bule:cout<<" bule";
break;
case white:cout<<" white";
break;
default:break;
}
}
}
cout<<endl;
}
}
}
}
cout<<"n="<<n<<endl;
}
#include<iostream>
using namespace std;
void mian()
{
enum color{red,yellow,bule,white,black};
enum color pri;
int loop,n,i,j,k;
n=0;
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;
cout.width(4);
for(loop=1;loop<=3;loop++)
{
switch(loop)
{
case 1:pri=(enum color)i;
break;
case 2:pri=(enum color)j;
break;
case 3:pri=(enum color)k;
break;
default:break;
}
switch(pri)
{
case red:cout<<" red";
break;
case yellow:cout<<" yellow";
break;
case bule:cout<<" bule";
break;
case white:cout<<" white";
break;
default:break;
}
}
}
cout<<endl;
}
}
}
}
cout<<"n="<<n<<endl;
}