#include<ctime>
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int n,a;
cout<<"抽奖程序"<<endl;
cout<<"请输入1-5:";
cin>>n;
srand(time(0));
a=rand()%5+1;
if(n==a)
cout<<"恭喜你,中奖了!奖金10元"<<endl;
else cout<<"没中奖!请付2元"<<endl;
cout<<"中奖号码是 "<<a<<endl;
return 0;
}
C++抽奖程序
于 2023-05-09 17:59:25 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)