有枚举类型的声明:enum WEEKDAY {Sun=7, Mon=1,Tue, Wed, Thu, Fri, Sat} workday;那么以下语句错误的是_____
A: enum WEEKDAY today=Fri;if( today >Fri) printf("Today is weekend!\n");
B: enum WEEKDAY today;today = (enum WEEKDAY)4;if( today >Fri) printf("Today is weekend!\n");
C: enum WEEKDAY today=Fri;tmp=today-2;if( tmp > 0) printf("Today is weekend!\n");
D: today = (enum WEEKDAY)4;if( today-2 > Fri) printf("Today is weekend!\n");
A: enum WEEKDAY today=Fri;if( today >Fri) printf("Today is weekend!\n");
B: enum WEEKDAY today;today = (enum WEEKDAY)4;if( today >Fri) printf("Today is weekend!\n");
C: enum WEEKDAY today=Fri;tmp=today-2;if( tmp > 0) printf("Today is weekend!\n");
D: today = (enum WEEKDAY)4;if( today-2 > Fri) printf("Today is weekend!\n");
举一反三
- 以下程序的输出结果为_________。 #include [stdio.h] int main() {enum Weekday{sun=7,mon=1,tue,wed,thu,fri,sat}; enum Weekday day=wed; printf("%d\n",day); } A: 2 B: 3 C: 4 D: 5
- 若有如下定义,则( ) 是不正确的语句。 enum weekday{ mon,tue,wed,thu,fri } workday; A: workday=(enum weekday)3; B: workday=(enum weekday)(4-2); C: workday=3; D: workday=thu;
- 有如下定义: enum weekday { sun, mon, tue=4, wed, thu, fri, sat } ; 则元素fri的值为_____________。(填阿拉伯数字)
- 如果将星期一视为一周的开始,我们想知道今天星期几,正确的公式是 A: WEEKDAY(TODAY()) B: WEEKDAY(TODAY(),1) C: WEEKDAY(TODAY(),2) D: WEEKDAY(TODAY,2)
- 若有如下定义,则 是不正确的语句。 enum weekday{ mon,tue,wed,thu,fri } workday;