#include<iostream>
using namespace std;
# define n 100
int a[101];
void p(){
srand((unsigned)time(NULL)); //获取随机数种子 rand()产品 0-32767 之间的随机数
for(int i=0;i<=n;i++){
a[i]=rand()%100;
}
for(int i=0;i<=n;i++){
cout<<a[i]<<" ";
}
cout<<endl;
}
/*
产生 0-1 之间的随机数
*/
void p2(){
srand((unsigned)time(NULL)); //获取随机数种子 rand()产品 0-32767 之间的随机数
for(int i=0;i<=n;i++){
cout<<rand()%2<<" ";
}
cout<<endl;
}
//产生在制定范围内的随机数
void p3(){
srand((unsigned)time(NULL)); //获取随机数种子 rand()产品 0-32767 之间的随机数
int low ,hight;
cin>>low>>hight;
for(int i=0;i<=n;i++){
cout<<(rand()%(hight-low+1))+low<<" ";
}
cout<<endl;
}
//产生制定长度的字符串
void p4(){
srand((unsigned)time(NULL)); //获取随机数种子 rand()产品 0-32767 之间的随机数
int a ,b; //表示的是 a 行 b 列。
cin>>a>>b;
string str;
for(int i=1;i<=a;i++){
str="";
for(int j=1;j<=b;j++){
int temp=rand()%2;
if(temp==0){
str+=rand()%(26)+65;
}else{
str+=rand()%(26)+96;
}
}
cout<<str<<endl;
}
}
int main(){ //产生的伪随机数
int j;
int t=time(0)%10;
cout<<" ***趣味摇奖机*** \n\n";
cout<<"请任选一个数字(0-9):";
cin>>j;
if(j<0||j>9){
return 0;
}
cout<<t<<endl;
if(j==t){
cout<<"特等奖"<<endl;
}else if(abs(j-t)<=1){
cout<<"一等奖"<<endl;
}else if(abs(j-t)<=2){
cout<<"二等奖"<<endl;
}else if(abs(j-t)<=3){
cout<<"三等奖"<<endl;
}else{
system("没有中奖哦");
}
p4();
system("pause");
}