Write a C language program, which includes at least one loop, one conditional statement and one user defined functions with function arguments。编写一个C语言程序,其中包括至少一个循环、一个条件语句和一个带有函数参数的用户定义函数。
没有其它条件了吗
#include <stdio.h>
enum Col
{
red=0,yellow,blue,white,black
};
char col[5][8]=
{
"red",
"yellow",
"bule",
"white",
"black"
};
void function(int red,int black)
{
int count=0;
for(int i=red;i<=black;i++)
{
for(int j=red;j<=black;j++)
{
for(int k=red;k<=black;k++)
{
if(i!=j&&j!=k&&i!=k)
{
printf("%d ",++count);
printf("%s %s %s\n",col[i],col[j],col[k]);
}
}
}
}
}
int main()
{
function(red,black);
return 0;
}