Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
46
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 <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int **macierz;
  9.     cout << "Program wygeneruje tablice wskaźników o podanym wymiarze n" << endl;
  10.     cout << "Podaj kolejno wymiar n:";
  11.     int n;
  12.     cin >> n;
  13.     macierz=new int*[n];
  14.     for (int i=0;i<n;i++)
  15.     {
  16.         macierz[i]=new int [n];
  17.     }
  18.     int licznik=0;
  19.     for (int i=0;i<n;i++)
  20.     {
  21.         for(int j=0;j<(i+1);j++)
  22.             {
  23.                 macierz[i][j]=licznik;
  24.                 licznik++;
  25.             }
  26.     }
  27.     cout <<endl << endl;
  28.       for (int i=0;i<n;i++)
  29.     {
  30.         for(int j=0;j<(i+1);j++)
  31.             {
  32.                 cout << macierz[i][j];
  33.             }
  34.             cout << endl;
  35.     }
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement