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

TOP

返回列表