以下关于枚举类型的使用,正确的是_____
A: enum{mon, tue, sat, thu, fri, wed, sun} day_1;
B: enum BOOL{NO, YES};BOOL judge = NO;BOOL decision = 1;
C: 有如下定义:enum MONTH{JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC}mon;mon=MAY;语句 printf("%s\n", mon); 将输出“MAY”
D: enum WEEKDYA{Sun=7, Mon=1, Tue, Wed, Thu, Fri, Sat }day;Tue=3;day=Tue;
A: enum{mon, tue, sat, thu, fri, wed, sun} day_1;
B: enum BOOL{NO, YES};BOOL judge = NO;BOOL decision = 1;
C: 有如下定义:enum MONTH{JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC}mon;mon=MAY;语句 printf("%s\n", mon); 将输出“MAY”
D: enum WEEKDYA{Sun=7, Mon=1, Tue, Wed, Thu, Fri, Sat }day;Tue=3;day=Tue;
举一反三
- 以下关于枚举类型的声明正确的是_____ A: enum day={mon,tue,wed,thu,fri,sat,sun}; B: enum day{mon=1,tue,wed,thu,fri,sat,sun}; C: enum day{mon;tue;wed;thu;fri;sat;sun}; D: enum day{mon,tue,wed,thu,fri,sat,mon};
- 以下关于枚举变量定义错误的是 A: enumweek{sun,mon,tue,wed,thue,fri,sat}weektest; B: enum{sun,mon,tue,wed,thue,fri,sat}weektest; C: enumweek{sun,mon,tue,wed,thue,fri,sat};enumweek weektest; D: enumweek{sun,mon,tue,wed,thue,fri,sat};
- 若有定义enum week {sun, mon, tue, wed, thu, fri, sat} day;以下正确的赋值语句是( )。 A: sun=0; B: sun=day; C: mon=sun+1; D: day=sun;
- enum weekday{mon,tue,wed,thu,fri,sat,sun}day; [br][/br] 则:此时定义的枚举变量是:______。
- 下面程序的输出结果是( )。#include <;stdio.h>;enum DAY{MON=1, TUE, WED, THU, FRI, SAT, SUN};int main(){enum DAY day;day = TUE;printf("%d",day);return 0;} A: TUE B: 0 C: 1 D: 2