返回列表 發帖
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     srand(time(NULL));
  8.     int a[]{0,0,0,0,0,0,0,0,0,0};
  9.     for(int i=0; i<=9; i++)
  10.     {

  11.         re:
  12.         a[i]=rand()%38+1;
  13.         for(int j=0; j<i; j++)
  14.         {
  15.             if(a[i]==a[j])
  16.             {

  17.                 goto re;
  18.             }
  19.         }





  20.     }
  21.     for(int i=0; i<=9; i++)
  22.     {
  23.         cout<<a[i]<<"  ";
  24.         _sleep(500);
  25.     }
  26.     system("pause");
  27.     return 0;
  28. }
複製代碼

TOP

返回列表