#include "iostream"
#include "ctime"
#include "cstdlib"
using namespace std;
#define N 10
int main()
{
int num[N] = {0};
int count = 0; //计数
int random = 0; //生成的随机数
bool flag = false; //随机数是否存在的标记
srand((unsigned)time(0)); //播种子
while(count < N)
{
random = ( rand() % (500000 - 1 + 1) ) + 1; //生成1-500000内的随机数
flag = false;
if(random % 100 == 55 || random % 100 == 77) //截取随机数后两位进行判断
{
for(int i = 0; i < count; i++) //若找到了判断是否已存在
{
if(num[i] == random)
{
flag = true;
break;
}
}
if(!flag) //不存在则记录
num[count] = random;
else
continue;
}
else
{
continue;
}
count++;
}
for(int i = 0; i < N; i++)
{
cout<<num[i]<<"\t";
}
system("pause");
return 0;
}