#include <bits/stdc++.h> using namespace std; int main() { int a,b,qian = 50; while(qian>0){ srand(time(0)); b = rand()%9+1; cout<<"请输入你选的号码?"; cin>>a; if(a==b){ qian+=90; cout<<"恭喜你!!!中奖了!!!奖励100元"<<"当前余额:"<<qian<<endl; }else{ qian-=10; cout<<"没中奖,扣除10元,中奖号码是:"<<b<<endl<<"当前余额:"<<qian<<endl; } } cout<<"破产了!!!"; return 0; }
标签:std,cout,qian,int,彩票,随机数 From: https://www.cnblogs.com/wangyihang-xh/p/17398032.html