下载此文档

C课程设计--福彩游戏.doc


文档分类:生活休闲 | 页数:约11页 举报非法文档有奖
1/11
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/11 下载此文档
文档列表 文档介绍
2
Vc++课程设计 福彩游戏
C++程序设计报告
2011年3月
(与王强同学2人合作完成)
课题名称:福彩游戏
难易等级:A
姓 名:
学号:
一、程序功能简介
这是一个类似于福彩的游
CCustomer(int x=100)
{nMoney=x;}
int SetWelfare();
void Compare(CWelfareLot &);
void Show();
};
class CWelfareLot
{
private:
int LotNum[6];
public:
CWelfareLot()
{}
void SetLot();
void PrintLot();
friend void CCustomer::Compare(CWelfareLot &);
5
Vc++课程设计 福彩游戏
};
void CCustomer::Show()
{ int a;
a=12/nRank*n;
nMoney=a+nMoney-n*2;
cout<<"您获得奖金为: "<<a<<endl;
cout<<"您一共还有彩金: "<<nMoney<<endl;
}
void CCustomer::Compare(CWelfareLot &fucai)
{ if(::total==4)
{
nRank=3;
cout<<"恭喜 您中了"<<nRank<<"等奖"<<endl;
}
else if(::total==5)
{
nRank=2;
cout<<"恭喜 您中了"<<nRank<<"等奖"<<endl;
}
else if(::total==6)
{
nRank=1;
cout<<"恭喜 您中了"<<nRank<<"等奖"<<endl;
}
if(::total==3||::total==2||::total==1||::total==0)
{ nRank=0;
cout<<"很遗憾 您没有中奖"<<endl;
nMoney-=(n*2);
cout<<"您一共还有彩金: "<<nMoney<<endl;
}
}
int CCustomer::SetWelfare()
{ cout<<"请输入您所要下的注数 没下一注2元 " <<endl;
cin>>n;
if(n>0&&n<nMoney/2+1)
return 1;
return 0;
}
void CWelfareLot::PrintLot()
{ for(int a=0;a<6;a++)
cout<<LotNum[6]<<'\t';
cout<<endl;
}
void CWelfareLot::SetLot()
6
Vc++课程设计 福彩游戏
{ int nRnd,nNum;
for(int i=0;i<6;i++)
{ nRnd=rand();
for(int j=0;j<nRnd;j++)
{ nNum=rand()%48+1;
if(nNum<10)
cout<<nNum<<'\b';
else
cout<<nNum<<'\b'<<'\b';
}
cout<<nNum<<" ";
LotNum[i]=nNum;
}
}
int isMatch(int test, int cp_num[] );
int getgamenbr();
int main()
{
char name[20], Reply2;
int play=1;
int truematch[6];
int getgamenbr();
CCustomer yonghu;
CWelfareLot fucai;
cout<<"-------------------------\n";
cout<<"* Welcome to PowerBall! *\n";
cout<<"-------------------------\n";
cout<<" -by \n\n";
cout<<"游戏规则 :"<<endl;
cout<<"当你输入六个数中有4个与

C课程设计--福彩游戏 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数11
  • 收藏数0 收藏
  • 顶次数0
  • 上传人annimy
  • 文件大小38 KB
  • 时间2022-03-20