变量定义
纸牌有黑红两色、四种花色,每种花色有13张,暂时不考虑大小王。
枚举定义:
enum ColorType {BlackColor, RedColor};
enum CardFlower {BLADE, HEART, CLUBS, SQUARE};
常量
const UInt16 defaultNumberOfCards = 52; //总共52张牌
结构定义:
//每张牌的数据格式
struct CardType
{
ColorType color; //牌的颜色
CardFlower flower; //牌的花型
UInt8 index; //UInt8 的值是从0~255,我们这里只有一副牌,也就是52张,不会超出范围。
};