查找奥运五环色的位置

查找奥运五环色的位置

/problem-sets/1336948160465235968/problems/1336959055094378496

不检查我就直接库函数,略略略(ε=ε=ε=┏(゜ロ゜;)┛)

strcmp函数本质上是利用指针构造的函数,可以点开头文件康康学习一下

#include<stdio.h>
#include<string.h>
int main(void) 
{
	char str[5][7]={"red", "blue", "yellow", "green", "black" };
	char sort[10];
	gets(sort);
	//指针是不可能指针的,顺序结构真香doge(切莫当真,这是个鬼的顺序结构)
	if(strcmp(sort,str[0])==0){printf("1");return 0;}
	if(strcmp(sort,str[1])==0){printf("2");return 0;}
	if(strcmp(sort,str[2])==0){printf("3");return 0;}
	if(strcmp(sort,str[3])==0){printf("4");return 0;}
	if(strcmp(sort,str[4])==0){printf("5");return 0;}
	printf("Not Found");
	return 0;
}
posted @ 2020-12-19 00:12  summeriver13  阅读(88)  评论(0)    收藏  举报