代码和编译好的程序托管在码云上,自取。

上代码。

#include <iostream>
#include <string>
using namespace std;

int main (){
/*
unsigned seed; //抽人数代码
seed = time(0);
srand(seed);
const int MIN_VALUE = 1;
const int MAX_VALUE = 40;
int n = rand() % (MAX_VALUE - MIN_VALUE + 1) + MIN_VALUE;
cout << "恭喜!" << n << "号抽奖:\n";
system("pause");
*/
int ma;
cout << "请输入抽奖轮次:";
cin >> ma;
for(;ma > 0;ma--)
{
unsigned seed;
seed = time(0);
srand(seed);
const int MIN_VALUE = 1;
const int MAX_VALUE = 11;
int k = rand() % (MAX_VALUE - MIN_VALUE + 1) + MIN_VALUE;
switch (k)
{
case 1:
cout << "恭喜!一等奖。\n";
break;
case 2:
cout << "恭喜,二等奖。\n";
break;
case 6:
cout << "恭喜,二等奖。\n";
break;
case 3:
cout << "恭喜,三等奖。\n";
break;
case 7:
cout << "恭喜,三等奖。\n";
break;
case 4:
cout << "恭喜,四等奖。\n";
break;
case 8:
cout << "恭喜,四等奖。\n";
break;
case 9:
cout << "遗憾!没有中奖。\n";
break;
case 10:
cout << "遗憾!没有中奖。\n";
break;
case 11:
cout << "遗憾!没有中奖。\n";
break;
}
system("pause");
}




system("pause");
return 0;
}




今天天上的星星都可以给你摘下来。