#include<ctime>
#include<stdlib.h>
using namespace std;
int main()
{
int seed[6]={0};
int n=5;
srand( (unsigned)time( NULL ));//產生種子,不要放在循環語句裏!
loop1:
while(n)
{
for(int i=0;i<6;i++) //產生seed數組隨機數
{
seed[i]=rand()%49+1;
}
for(int k=0;k<5;k++) //判斷seed數組裏是否有重複的數
{
for(int j=k+1;j<6;j++)
if(seed[k]==seed[j])
goto loop1;
}
for( int j=0;j<6;j++) //輸出數組
{
cout<<seed[j]<<" ";
}
cout<<endl;
n--;
}
return 0;
}