SHARE
TWEET

Tablice wielowymiarowe

a guest Dec 12th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int tab[100][100];
  7.  
  8. void losuj(int wiersze, int kolumny)
  9. {
  10.     for (int i = 0; i < wiersze; i++)
  11.     {
  12.         for (int j = 0; j < kolumny; j++)
  13.             tab[i][j] = rand() % 20;
  14.     }
  15. }
  16.  
  17. void wypisz(int wiersze, int kolumny)
  18. {
  19.     for (int i = 0; i < wiersze; i++)
  20.     {
  21.         for (int j = 0; j < kolumny; j++)
  22.         {
  23.             cout << setw(3) << tab[i][j];
  24.         }
  25.         cout << endl;
  26.     }
  27. }
  28.  
  29.  
  30. int _tmain(int argc, _TCHAR* argv[])
  31. {
  32.     int w, k;
  33.     cout << "Ile wierszy i kolumn? ";
  34.     cin >> w >> k;
  35.     losuj(w, k);
  36.     wypisz(w, k);
  37.     return 0;
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top