返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     cout<<"4個介於0~9的隨機亂數:"<<endl;
  8.    
  9.     srand(time(NULL));
  10.     int n[4];     
  11.     int j=1;      
  12.     while(j<=20)
  13.     {
  14.         for(int i=0; i<4; i++)
  15.         {
  16.              n[i]=rand()%10;   
  17.              cout<<n[i]<<" ";
  18.         }
  19.         cout<<endl;
  20.         _sleep(500);
  21.         j++;
  22.     }      
  23.     system("pause");
  24.     return 0;
  25. }
複製代碼

TOP

返回列表