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

TOP

返回列表