MeehoweCK

Untitled

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