摘要: 这是谭浩强课本上枚举类型的例子,但是我贴这个例子的代码不是因为枚举类型,是因为这个代码使用switch语句用得非常好,值得一贴。题目是这样的:有红、黄、蓝、白、黑5中颜色的球若干,依次取出3个球,求3个球为不同颜色时的排列方式。 1 #include 2 3 int main(){ 4 enum color {red,yellow,blue,white,black}; 5 enum color i,j,k,pri; 6 int n=0,loop; 7 for(i=red;i<=black;i++) 8 for(j=red;j<=black;j+... 阅读全文
posted @ 2013-10-25 22:09 Andy Cheung 阅读(335) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 5 #define LEN sizeof(struct student) 6 7 struct student{ 8 long num; 9 float score; 10 stru... 阅读全文
posted @ 2013-10-25 17:02 Andy Cheung 阅读(282) 评论(0) 推荐(0) 编辑