#include "windows.h"
#include <iostream>
#include "time.h"
using namespace std;
//产生随机数
void SetRandNum(int * paArray,int nAmount,int nMax)
{
srand((unsigned)time(NULL));
//srand(sdfsdfsfsdf);
for(int i = 0; i < nAmount ; ++i)
{
paArray[i]= rand()%nMax;
//判断
Sleep(150);
for(int j = 0; (j<i)&&(i!=0); ++j)
{
if(paArray[i] == paArray[j])
{
i--;
break;
}
}
}
}
void DoubleColorBall(int nNum = 1)
{
while(nNum != 0)
{
if(nNum!=1)
cout<<"第"<<nNum<<"注-->"<<endl;
int nRadBall[5];
int nBlueBall[1];
SetRandNum(nRadBall,5,22);
SetRandNum(nBlueBall,1,16);
cout<<endl<<"双色球随机结果:"<<endl<<endl<<"红球: ";
for(int i = 0;i <5;++i)
cout<<nRadBall[i]<<" ";
cout<<"蓝球: ";
cout<<nBlueBall[0]<<" ";
cout<<endl<<endl<<endl;
nNum--;
}
}
void For3DBall(int nNum = 1)
{
while(nNum != 0)
{
if(nNum!=1)
cout<<"第"<<nNum<<"注-->"<<endl;
int n3DBall[3];
SetRandNum(n3DBall,3,9);
cout<<endl<<"福彩3D随机结果:"<<endl<<endl<<"福彩3D: ";
for(int i = 0 ; i <3 ; ++i)
cout<<n3DBall[i]<<" ";
cout<<endl<<endl<<endl;
nNum -- ;
}
}
void DaLeTouBall(int nNum = 1)
{
while(nNum != 0)
{
if(nNum!=1)
cout<<"第"<<nNum<<"注-->"<<endl;
int nRadBall[5];
int nBlueBall[2];
SetRandNum(nRadBall,5,22);
SetRandNum(nBlueBall,2,16);
cout<<endl<<"大乐透随机结果:"<<endl<<endl<<"红球: ";
for(int i = 0;i <5;++i)
cout<<nRadBall[i]<<" ";
cout<<"蓝球: ";
for(int i = 0;i <2;++i)
cout<<nBlueBall[i]<<" ";
cout<<endl<<endl<<endl;
nNum--;
}
}
int main()
{
system("title 中奖神器");
system("color a");
int iType=0;
int iNum = 0;
cout<<"请输入类型: 1.福彩3D 2.双色球 3.大乐透"<<endl;
cin>>iType;
cout<<"请输入注数:"<<endl;
cin>>iNum;
switch(iType)
{
case 1: //福彩3D
For3DBall(iNum);
break;
case 2://
DoubleColorBall(iNum);
break;
case 3:
DaLeTouBall(iNum);
break;
default:
cout<<"输入的类型不正确!";
break;
}
cout<<"Good Luck!"<<endl;
int a;
cin>>a;
//system("pause");
return 0;
}
机选彩票代码
最新推荐文章于 2024-06-28 21:32:57 发布