Problem Description
Input
Output
Example Input
blue yellow purple
Example Output
Bluebells are blue. Sunflower are yellow. I don't know about the color purple.
Hint
请用枚举类型实现。
#include<stdio.h>
#include<string.h>
enum color{red,orange,yellow,green,blue,violet,no}w;
void main()
{
char str[31];
while(gets(str))
{
if(strcmp(str,"red")==0)
w=red;
else if(strcmp(str,"orange")==0)
w=orange;
else if(strcmp(str,"yellow")==0)
w=yellow;
else if(strcmp(str,"green")==0)
w=green;
else if(strcmp(str,"blue")==0)
w=blue;
else if(strcmp(str,"violet")==0)
w=violet;
else
w=no;
switch(w)
{
case red:printf("Rose are red.\n");break;
case orange:printf("Poppies are orange.\n");break;
case yellow:printf("Sunflower are yellow.\n");break;
case green:printf("Grass are green.\n");break;
case blue:printf("Bluebells are blue.\n");break;
case violet:printf("Violets are violet.\n");break;
case no:printf("I don't know about the color %s.\n",str);break;
}
}
}