#include<iostream>
#include<time.h>
#include<stdlib.h>
using namespace std;
void main()
{
int a[7];
int b[7];
int i;
char s;
int num=0;
cout<<"*******欢迎使用辽宁风彩福利彩票35选7号码预算系统*******\n";
cout<<"请输入你想要买的号码:\n";
while(s!='y'&&s!='Y')
{
for (i=0; i<7; i++)
{
cin>>a[i];
if (a[i]<=0 || a[i]>=36 )
{
cout<<"你所输入的号码有误,请重新输入!"<<endl;
cin>>a[i];
}
}
cout<<"\n你所购买的号码为:\n";
for ( i=0; i<7; i++)
{
cout<<a[i]<<'\t';
}
cout<<"\n是否确定好吗?(y or n)\n";
cin>>s;
}
srand((unsigned)time(NULL));
for (i=0; i<7; i++)
{
int j=rand();
b[i]=j%35+1;
}
cout<<"\n本次开奖号码为:\n";
for (i=0; i<7; i++)
{
cout<<b[i]<<'\t';
}
for (int j=0; j<7; j++)
{
for (i=0; i<7; i++)
{
if(a[i]==b[j]) num++;
}
}
if(num==0) cout<<"\n\n很遗憾,你这次未能中奖,下次好远!"<<endl;
else cout<<"\n\n恭喜,你一共中了"<<num<<"个号码,共获得奖金"<<num*100<< "元!\n";
#include<iostream>
#include<time.h>
#include<stdlib.h>
using namespace std;
int main()
{
int a[7];
int b[7];
int i;
char s = 'n';
int num=0;
cout<<"*******欢迎使用辽宁风彩福利彩票35选7号码预算系统*******\n";