#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef enum
{
LED_1,
LED_2,
LED_3,
}LED;
typedef enum
{
LED_ON,
LED_OFF,
}LED_CON;
void init(LED L)
{
switch(L)
{
case LED_1:
printf("初始化了LED_1灯\n");
break;
case LED_2:
printf("初始化了LED_2灯\n");
break;
case LED_3:
printf("初始化了LED_3灯\n");
break;
}
}
void con(LED L,LED_CON C)
{
switch(L)
{
case LED_1:
switch(C)
{
case LED_ON:
printf("开启了LED_1灯");
break;
case LED_OFF:
printf("关闭了LED_1灯");
break;
}
break;
case LED_2:
switch(C)
{
case LED_ON:
printf("开启了LED_2灯");
break;
case LED_OFF:
printf("关闭了LED_2灯");
break;
}
break;
case LED_3:
switch(C)
{
case LED_ON:
printf("开启了LED_3灯");
break;
case LED_OFF:
printf("关闭了LED_3灯");
break;
}
break;
}
putchar(10);
}
int main(int argc, const char *argv[])
{
init(LED_1);
con(LED_1,LED_ON);
return 0;
}
标签:盏灯,case,LED,void,break,switch,printf,OFF From: https://blog.csdn.net/m0_75102741/article/details/136662591