#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main(int argc, char** argv) { int m; cin>>m; srand(time(0)); int a; while(a==0){ a=rand()%6; } if (a==m){ cout<<"中奖了"; }else{ cout<<"没中奖"<<m<<" "<<a; } return 0; }
标签:std,rand,int,彩票,随机数,include From: https://www.cnblogs.com/wangyueshuo/p/17397943.html