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

  18.    
  19.     system("pause");
  20.     return 0;   
  21. }
複製代碼

TOP

返回列表