返回列表 發帖
  1. #include<iostream>
  2. #include<ctime>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n[4];
  7.     srand(time(NULL));
  8.     for(int i=1; i<=20; i++)
  9.     {
  10.         for(int j=0;j<=3;j++)
  11.         {
  12.             re:
  13.             n[j]=rand()%10;
  14.             if(n[j-1]!=n[j]&&n[j-2]!=n[j]&&n[j-3]!=n[j])
  15.             {
  16.                 cout<<n[j]<<" ";
  17.             }
  18.             else
  19.             {
  20.                 goto re;
  21.             }
  22.         }
  23.         cout<<endl;
  24.         _sleep(500);
  25.     }
  26.     system("pause");   
  27.     return 0;
  28. }
複製代碼

TOP

返回列表