#include <stdio.h>


enum Color{Red=1,Blue,Green}color;


int main(){

int  icolor;

printf("请输入颜色Red是1,Blue是2,Green是3数字\n");

scanf("%d",&icolor);

switch(icolor){

case Red:

printf("the choice is Red\n");

break;

case Blue:

printf("the choice is Blue\n");

break;

case Green:

printf("the choice is Green\n");

break;

default:

printf("???\n");

break;

}

return 0;

}

vv.jpg

利用枚举选择喜欢的颜色