返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      cout<<"4個介於0~9的隨機亂數:"<<endl;
  7.      srand(time(NULL));
  8.       int n[4];        
  9.     int j=1;        
  10.     while(j<=20)
  11.     {
  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

返回列表