#include<stdio.h>
#include<string.h>
int main()
{
int i;
char *color[5]={"red","yellow","blue","black","green"};
char str[20];
printf("Input a color:");
scanf("%s",&str);
for(i=0;i<5;i++)
if(strcmp(str,color[i])==0)
break;
if(i<5)
printf("position:%d",i+1);
else
printf("Not Found\n");
return 0;
}
/*查找奥运五环的位置,用指针数组实现*/
最新推荐文章于 2023-12-02 08:00:00 发布