Guest User

Untitled

a guest
Jun 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. //PostCondition:Array i sfilled with random numbers
  2. void fillRandom(Array<int> & data, int range=100)
  3. {
  4. for (int i=0; i < data.length(); i++)
  5. data[i] = rand() % range;
  6.  
  7. }
  8.  
  9.  
  10.  
  11.  
  12. int main() {
  13. // code goes here
  14.  
  15. Array<int> a1(20);
  16. fillRandom(a1);
  17.  
  18. for (int i=0; i < a1.length(); i++)
  19.  
  20. cout << a1[i] << endl;
  21.  
  22.  
  23.  
  24. // ---------------------------------------------------
  25. cout << endl << "Press enter to quit";
  26. cin.get();
  27. return 0;
  28. }
Add Comment
Please, Sign In to add comment