-
个人简介
hello
//彩票(概率优化版) 可存档 #include<iostream> #include<ctime> #include<cstdlib> #include<windows.h> #include<fstream> using namespace std; int main(){ ifstream fin("caipiao.txt"); int money=0; fin>>money; fin.close(); if(money==0){ cout<<"generous的hsy看你没钱,好心施舍了你100元 "; money=100; } cout<<"你的资产 : "<<money<<" 元\n"; int i,ia,ib,ic,id,ie,if1,ig,ih,n,a,A; srand((unsigned)time(NULL)); cout<<"彩票"<<endl<<"按任意键购票,20元1张"<<endl; system("pause"); int Mon=money; if(money>=20){ money-=20; }else{ cout<<"资产不足,购票失败!\n请打开\"caipiao.txt\"修改你的资产"; return 0; }cout<<"购票成功"; Sleep(2000); system("cls"); cout<<"彩票"<<endl<<"请输入你的号码(1~99;输入其他数随机产生):"; cin>>n; system("pause"); system("cls"); if(n<=0||n>=100){ n=rand()%99+1; } cout<<"彩票"<<endl<<"你的号码:"<<n<<endl<<"●●●●●●●●●●●●●●●●●●●●●10元"<<endl<<"●●●●●●●●●●●●●●●●●20元"<<endl<<"●●●●●●●●●●●●●●●50元"<<endl<<"●●●●●●●●●●●●200元"<<endl<<"●●●●●●●●●500元"<<endl<<"●●●●●●1000元"<<endl<<"●●●5000元"<<endl<<"●●400000元"<<endl<<"按任意键刮奖"<<endl; system("pause"); system("cls"); cout<<"彩票"<<endl<<"你的号码:"<<n<<endl; for(i=1;i<=8;i++){ if(i=1){ for(ia=1;ia<=21;ia++){ a=rand()%99+1; if(n==a){ cout<<"√"; money+=10; }else{ a=rand()%99+1; if(n==a){ cout<<"√"; money+=10; } } if(a<10){ cout<<0; } cout<<a<<" "; Sleep(250); } cout<<" 10元"<<endl; }if(i=2){ for(ib=1;ib<=18;ib++){ a=rand()%99+1; if(n==a){ cout<<"√"; money+=20; }if(a<10){ cout<<0; } cout<<a<<" "; Sleep(250); } cout<<" "<<"20元"<<endl; }if(i=3){ for(ic=1;ic<=15;ic++){ a=rand()%99+1; if(n==a){ if(a==1){ a=rand()%3+a; }else if(a==99){ a=rand()%3+a-2; }else{ a=rand()%3+a-1; }if(n==a){ cout<<"√"; money+=50; } }if(a<10){ cout<<0; } cout<<a<<" "; Sleep(250); } cout<<" "<<"50元"<<endl; }if(i=4){ for(id=1;id<=12;id++){ a=rand()%99+1; if(n==a){ if(a<5){ a=rand()%9+1; }else if(a>95){ a=rand()%9+a-4-(4-(99-a)); }else{ a=rand()%9+a-4; }if(n==a){ cout<<"√"; money+=200; } }if(a<10){ cout<<0; } cout<<a<<" "; Sleep(250); } cout<<" "<<"200元"<<endl; }if(i=5){ for(ie=1;ie<=9;ie++){ a=rand()%99+1; if(n==a){ if(a<13){ a=rand()%25+1; }else if(a>87){ a=rand()%25+a-12-(12-(99-a)); }else{ a=rand()%25+a-12; } } if(n==a){ cout<<"√"; money+=500; }if(a<10){ cout<<0; } cout<<a<<" "; Sleep(250); } cout<<" "<<"500元"<<endl; }if(i=6){ for(if1=1;if1<=6;if1++){ a=rand()%99+1; if(n==a){ if(a<26){ a=rand()%51+1; }else if(a>74){ a=rand()%51+a-25-(25-(99-a)); }else{ a=rand()%51+a-25; } } if(n==a){ cout<<"√"; money+=1000; }if(a<10){ cout<<0; } cout<<a<<" "; Sleep(250); } cout<<" "<<"1000元"<<endl; }if(i=7){ for(ig=1;ig<=3;ig++){ a=rand()%99+1; if(n==a){ a=rand()%99+1; } if(n==a){ cout<<"√"; money+=5000; }if(a<10){ cout<<0; } cout<<a<<" "; Sleep(250); } cout<<" "<<"5000元"<<endl; }if(i=8){ a=0; a=rand()%99+1; if(n==a){ a=rand()%99+1; }if(n==a){ a=rand()%99+1; } if(n==a){ cout<<"√"; money+=200000; }if(a<10){ cout<<0; } cout<<a<<" "; Sleep(250); a=rand()%99+1; if(n==a){ a=rand()%99+1; }if(n==a){ a=rand()%99+1; } if(n==a){ cout<<"√"; money+=200000; }if(a<10){ cout<<0; } cout<<a<<" "; Sleep(250); cout<<" "<<"200000元"<<endl; } }cout<<"\n本次中奖总金额 : "<<money-Mon+20<<"元 共盈利 : "<<money-Mon<<"元\n已存入资产"; ofstream fout("caipiao.txt"); fout<<money; fout.close(); string ss; cout<<"\n是否继续购买? 输入\"y\"继续,输入其他内容结束程序"<<endl; cin>>ss; if(ss=="y"){ Sleep(500); system("cls"); main(); } return 0; }
@海贼王菌 的个人主页 - 微博 (weibo.com) 白漫 (baidu.com) 火影忍者AI_百度图片搜索 (baidu.com) 海贼王AI_百度图片搜索 (baidu.com) https://asu4bxcade6xvn6ov4ipo.aikanhm.com/chapter/1435-1.html
-
通过的题目
-
最近活动
This person is lazy and didn't join any contests or homework. -
最近编写的题解
This person is lazy and didn't write any solutions. -
Stat
-
Rating
题目标签
- 系统测试
- 1