Advertisement
WiktoriaRatajczyk

Zadanie7

Apr 16th, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. void tablica(int n, int *tab, int min, int max)
  8. {
  9.     while(n--)
  10.         *tab++=min+rand()%(max-min+1);
  11. }
  12.  
  13. void wyswietl(int n, int *tab)
  14. {
  15.     while(n--)
  16.         cout<<*tab++<<" ";
  17.         cout<<endl;
  18. }
  19. int main()
  20. {
  21.     int n=10;
  22.     srand(time(0));
  23.     int a[n];
  24.     tablica(n,a,1,50);
  25.     wyswietl(n,a);
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement