作业社区
探索学习新天地,共享知识资源!
王小屁的理想主义 的学生作业:
#include enum COLOR { red=1, green=2, yellow, blue, black, }; int main() { int col; printf("请输入整数数据:\n"); scanf("%d",&col); switch (col) { case 1: printf("the color is red\n"); break; case 2: printf("the color is green\n"); break; case 3: printf("the color is yellow\n"); break; case 4: printf("the color is blue\n"); break; case 5: printf("the color is black\n"); break; default: printf("it is wrong!\n"); } return 0; } 【图片】
+180
王小屁的理想主义 的学生作业:
#include typedef struct { unsigned char Red; unsigned char Green; unsigned char Blue; }RGB_t; typedef union { RGB_t rgb; unsigned int value; }PIX_t; int main() { PIX_t co_lor; co_lor.rgb.Red=0x11; co_lor.rgb.Red=0x22; co_lor.rgb.Red=0x33; printf("value=%#x\n",co_lor.value); /*小端模式下,先声明的存在低位,最后声明的存在高位,输出结果应该为0x332211*/ return 0; } 输出结果:value=0x332211
+178