#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
typedef enum {
a1=49,
a2
}name;
int main()
{
int a;
name b;
a=getchar();
b=a;
switch(b){
case a1:
printf("1st output");
break;
case a2:
printf("2nd output");
}
}
#if 0
typedef enum{
RUNNING=49,
STOPPED,
FAILED,
HIBERNATING
} MACHINE_STATE;
int main(void) {
int input1;
MACHINE_STATE state;
printf("Please provide integer in range [1-4]: ");
input1 = getchar();
state = input1;
switch (state) {
case RUNNING:
printf("Machine is running\n");
break;
case STOPPED:
printf("Machine is stopped\n");
break;
case FAILED:
printf("Machine is in failed state\n");
break;
case HIBERNATING:
printf("Machine is hibernated\n");
break;
default:
break;
}
exit(EXIT_SUCCESS);
}
#endif
To embed this program on your website, copy the following code and paste it into your website's HTML: