2023年3月26号,随机抽奖程序
//火龙编程训练
#include<bits/stdc++.h>
using namespace std;
int a[] = {1,3,2,4,5};
string p[] = {"何家豪", "鲍彦恺" , "李云" , "张翰哲" };
int he, bao, li, zhang;
int main(){
//sort(a+0 , a+5) ;//默认是从小到大
// reverse(a+0, a+5);
srand(time(0));//随机种子
//random_shuffle(a+0, a+5);//打乱函数
//for(int i=0; i<5; i++) {
// cout << a[i] <<" " ;
//}
//system("请按开始:");
//system("pause");
for(int i=0; i<20; i++){
int shu = rand() %4;
if(shu == 0){
he ++ ;
}
if(shu == 1){
bao++;
}
if(shu == 2){
li ++ ;
}
if(shu == 3){
zhang ++;
}
cout << p[ shu ] << endl;
}
cout << "--------公布获奖结果:------------" <<endl;
cout << "何家家" << he <<endl;
cout << "鲍家家" << bao <<endl;
cout << "李家家" << li << endl;
cout << "张家家" << zhang <<endl;
return 0;
}