#include <stdio.h>
enum Level{
OK=1, CANCEL=2, ERROR=4, WARNNING=8
};
int main(void){
int u_level;
puts("Enter Level (1 for OK, 2 for CANCEL, 4 for ERROR, 8 for WARNNING or a combination): " );
scanf("%i", &u_level);
if ((u_level&OK) == OK)
puts("OK");
if ((u_level&CANCEL) == CANCEL)
puts("CANCEL");
if ((u_level&ERROR) == ERROR)
puts("ERROR");
if ((u_level&WARNNING) == WARNNING)
puts("WARNNING");
return 0;
}
No comments:
Post a Comment