一、枚举
定义:枚举是 一种用户定义的数据类型,它用的关键字 enum
枚举类型名字通常并不真的使用,要用的是在大括号里地名字,因为它们就是常量符合,它们的类型是int,值则依次从0到n。
enum colors {red, yellow, green}
语法:enum 枚举类型名称{名字0m, ..., 名字n};
案例一:自动计数的枚举
//
//...
分类:
其他好文 时间:
2015-04-27 00:31:23
阅读次数:
148
We have a machine for painting cubes. It is supplied with three different colors: blue, red and green. Each face of the cube gets one of these colors....
分类:
其他好文 时间:
2015-04-26 15:04:55
阅读次数:
142
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the integers...
分类:
其他好文 时间:
2015-04-26 10:57:53
阅读次数:
170
解题报告 之 ZOJ 2332 Gems 构图 最大流
Wealthy alsomagic!
Supernatural alsomagic!
But also poor alsomagic!
Because he is now puzzled by a problem, and will go crazy if you can't help him.
alsomagic has a lot of gems with different colors and shapes. His supernatu...
分类:
其他好文 时间:
2015-04-26 09:27:51
阅读次数:
128
function SuperType(name){ this.name=name; this.colors=['black', 'white'] } SuperType.prototype.sayNa...
分类:
编程语言 时间:
2015-04-25 16:21:54
阅读次数:
134
leetcode Sort Colorsleetcode Sort Colors计数排序注: 题目的要求是将 A 数组重新排列成有序, 而不是将排序的序列输出Sort ColorsGiven an array with n objects colored red, white or blue, so...
分类:
其他好文 时间:
2015-04-22 23:53:37
阅读次数:
121
Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, wh...
分类:
其他好文 时间:
2015-04-22 11:18:11
阅读次数:
94
1、基于Eclipse的Android开发环境ADT,代码中的中文显示字体很小,很难看,可修改Eclipse中的Java代码的字体:Window->Preferences ->General -> Appearance -> Colors and Fonts -> Java -> Java Edit...
分类:
系统相关 时间:
2015-04-20 14:48:16
阅读次数:
299
三个指针,就是比较容易糊涂,要想清楚public class Solution { public void sortColors(int[] A) { if(A==null || A.length0 && A[p2]==2){ p2--; } ...
分类:
其他好文 时间:
2015-04-16 12:01:47
阅读次数:
146
class MyView extends View { float phase; PathEffect[] effects = new PathEffect[7]; int[] colors; private Paint paint; Path path; pub...
分类:
移动开发 时间:
2015-04-15 21:01:39
阅读次数:
152