Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int **macierz;
- cout << "Program wygeneruje tablice wskaźników o podanym wymiarze n" << endl;
- cout << "Podaj kolejno wymiar n:";
- int n;
- cin >> n;
- macierz=new int*[n];
- for (int i=0;i<n;i++)
- {
- macierz[i]=new int [n];
- }
- int licznik=0;
- for (int i=0;i<n;i++)
- {
- for(int j=0;j<(i+1);j++)
- {
- macierz[i][j]=licznik;
- licznik++;
- }
- }
- cout <<endl << endl;
- for (int i=0;i<n;i++)
- {
- for(int j=0;j<(i+1);j++)
- {
- cout << macierz[i][j];
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement