彩票兑奖程序

//各种彩票类的父类
class Ticket
{
protected:
std::vector data_;//经过解析的彩票格式化数据
public:
Ticket(std::string ticket_str);
Ticket(){}
sector getSector(int index) const;//get

bool isMultiple();//复式?
virtual size_t firstLength()=0;//前区长度
virtual size_t secondLength()=0;//后区长度
virtual void parse(std::string s);//接收字符串型格式,解析
virtual boost::shared_ptr CreateSafeInstance()=0; virtual std::vector& getData(boost::shared_ptr ticket)=0;//把复式解析成单式,智能指针返回


virtual std::ostream& formatedCout(std::ostream& o) const{return o< virtual const char* sep_char() const{return " ";}

std::vector > getTickets();

std::string ticketId;

friend std::ostream &operator<<(std::ostream &o,const Ticket &t);
};


超级大乐透

class BigHappyTicket: public Ticket
{
public:
BigHappyTicket(std::string ticket_str);
BigHappyTicket(){}
virtual size_t firstLength(){return 5;}
virtual size_t secondLength(){return 2;}
virtual boost::shared_ptr CreateSafeInstance();
virtual std::vector& getData(boost::shared_ptr ticket);

};


双色球

class Color2Ticket: public Ticket
{
public:
Color2Ticket(std::string ticket_str);
Color2Ticket(){}
virtual size_t firstLength(){return 6;}
virtual size_t secondLength(){return 1;}
virtual boost::shared_ptr CreateSafeInstance();
virtual std::vector& getData(boost::shared_ptr ticket);


};



略……

你可能感兴趣的:(c++)