Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. const int r = 3;
  8.  
  9. struct kwadrat
  10. {
  11.  
  12.     int tab[r][r];
  13.  
  14. };
  15. //losuj
  16. //wypisz
  17. //wczytaj
  18. //czymagiczny
  19.  
  20. void wypisz(const kwadrat&);
  21. void losuj(const kwadrat&);
  22.  
  23. int main()
  24. {
  25.  
  26.     srand(time(0));
  27.  
  28.     kwadrat k;
  29.  
  30.     wypisz(k);
  31.     losuj(k);
  32.  
  33.  
  34.  
  35.     return 0;
  36. }
  37.  
  38. void losuj(const kwadrat& kwa)
  39. {
  40.  
  41.     for(int i = 0; i < r; i++)
  42.     {
  43.  
  44.         for(int j = 0; j < r; j++)
  45.         {
  46.  
  47.             kwa.tab[i][j] = rand()%10;
  48.  
  49.         }
  50.  
  51.     }
  52.  
  53. }
  54. void wypisz(const kwadrat& k)
  55. {
  56.  
  57.     for(int i = 0; i < r; i++)
  58.     {
  59.  
  60.         for(int j = 0; j < r; j++)
  61.         {
  62.  
  63.             cout << k.tab[i][j] << "\t";
  64.  
  65.         }
  66.  
  67.     }
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement