电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

c++程序彩票游戏

c++程序彩票游戏_第1页
1/7
c++程序彩票游戏_第2页
2/7
c++程序彩票游戏_第3页
3/7
#include #include #include #include using namespace std; class CSportLot; //声明体彩类 class CWelfareLot; //声明福彩类 class CCustomer //定义用户类 { private: int *pSport; //体彩投注号码 int *pWelfare; //福彩投注号码 public: CCustomer(){pSport=pWelfare=NULL;} void SetSport(int *p){pSport=p;} void Setwelfare(int *p){pWelfare=p;} int Compare(CSportLot &); //比较体彩,返回中奖等级 int Compare(CWelfareLot &); //比较福彩,返回中奖等级 }; class CSportLot //定义体彩 { private: int LotNum[7]; //定义中奖号码 public: CSportLot(){} void SetLot(); //开奖过程 void PrintLot(); //输出大奖号码 friend int CCustomer::Compare(CSportLot &); //用户类,比较是否中奖 }; class CWelfareLot //定义福彩,具体运作与体彩类似 { private: int LotNum[6]; public: CWelfareLot(){} void SetLot(); void PrintLot(); friend int CCustomer::Compare(CWelfareLot &); }; int CCustomer::Compare(CSportLot &sportlot) //比较是否中奖,返回中奖等级 { int t=0; for(int i=0;i<7;i++) if(sportlot.LotNum[i]==pSport[i]) t++; return 7-t; } int CCustomer::Compare(CWelfareLot &welfarelot) { int t=0; for(int i=0;i<6;i++) if(welfarelot.LotNum[i]==pWelfare[i]) t++; return 6-t; } void CSportLot::SetLot(void) //开奖 { int nRnd,nNum; for(int i=0;i<7;i++) { nRnd=rand(); for(int j=0;j

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

c++程序彩票游戏

确认删除?
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群