15、若定义enum color{red,yellow,green=5,blue,white}aa;则执行以下语句后aa的值为-—C—————.aa=white;printf(”%d”,aa);(A)white (B)4 (C)7 (D)5为什么,还有enum
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/11 20:39:46
![15、若定义enum color{red,yellow,green=5,blue,white}aa;则执行以下语句后aa的值为-—C—————.aa=white;printf(”%d”,aa);(A)white (B)4 (C)7 (D)5为什么,还有enum](/uploads/image/z/5832027-27-7.jpg?t=15%E3%80%81%E8%8B%A5%E5%AE%9A%E4%B9%89enum+color%7Bred%2Cyellow%2Cgreen%3D5%2Cblue%2Cwhite%7Daa%3B%E5%88%99%E6%89%A7%E8%A1%8C%E4%BB%A5%E4%B8%8B%E8%AF%AD%E5%8F%A5%E5%90%8Eaa%E7%9A%84%E5%80%BC%E4%B8%BA-%E2%80%94C%E2%80%94%E2%80%94%E2%80%94%E2%80%94%E2%80%94.aa%3Dwhite%3Bprintf%28%E2%80%9D%25d%E2%80%9D%2Caa%29%3B%28A%29white+%28B%294+%28C%297+%28D%295%E4%B8%BA%E4%BB%80%E4%B9%88%2C%E8%BF%98%E6%9C%89enum)
15、若定义enum color{red,yellow,green=5,blue,white}aa;则执行以下语句后aa的值为-—C—————.aa=white;printf(”%d”,aa);(A)white (B)4 (C)7 (D)5为什么,还有enum
15、若定义enum color{red,yellow,green=5,blue,white}aa;则执行以下语句后aa的值为-—C—————.
aa=white;
printf(”%d”,aa);
(A)white (B)4 (C)7 (D)5
为什么,还有enum
15、若定义enum color{red,yellow,green=5,blue,white}aa;则执行以下语句后aa的值为-—C—————.aa=white;printf(”%d”,aa);(A)white (B)4 (C)7 (D)5为什么,还有enum
enum color { red,yellow,green = 5,blue,white }
以C#中,上面的语句是定义枚举类型,是值类型.
枚举类型可转成int型,但需要显示转换,枚举型转成int型时,默认从0开始,但可通过自定义来改变其顺序.
Console.WriteLine((int)color.red); //输出0
Console.WriteLine((int)color.yellow); //输出1
Console.WriteLine((int)color.green ); //输出5
Console.WriteLine((int)color.blue); //输出6
Console.WriteLine((int)color.white); //输出7
看你使用的printf("%d",aa);以vc++语法,应该也是这样的.