Advertisement
MeehoweCK

Untitled

Mar 30th, 2023
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. const short K = 5;
  8. const short W = 3;
  9.  
  10. void wypelnij_losowymi(int tablica[W][K])
  11. {
  12.     srand(time(nullptr));
  13.     for(short i = 0; i < W; ++i)
  14.         for(short j = 0; j < K; ++j)
  15.             tablica[i][j] = rand();
  16. }
  17.  
  18. void wypisz_tablice(int tablica[W][K])
  19. {
  20.     for(short i = 0; i < W; ++i)
  21.     {
  22.         for(short j = 0; j < K; ++j)
  23.             cout << tablica[i][j] << '\t';
  24.         cout << endl;
  25.     }
  26. }
  27.  
  28. int main()
  29. {
  30.     int tablica[W][K];
  31.     wypelnij_losowymi(tablica);
  32.     wypisz_tablice(tablica);
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement