Advertisement
WiktorMalisak

Zad 15

Apr 30th, 2020
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <windows.h>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int x;
  8.     cout << "Podaj wartosci tablicy dwuwymiarowej (t[x][x]): ";
  9.     cin >> x;
  10.     int tab[x][x];
  11.  
  12.      for (int i=0; i<x; i++)
  13.     {
  14.         for (int j=0; j<x; j++)
  15.         {
  16.             if(i==j)
  17.             {
  18.            tab[i][j]=0;
  19.             }
  20.             else
  21.             {
  22.             tab[i][j]=1;
  23.             }
  24.         }
  25.     }
  26.     for (int i=0; i<x; i++)
  27.         {
  28.             for (int j=0; j<x; j++)
  29.         {
  30.             cout<<tab[i][j];
  31.         }
  32.         cout<<endl;
  33.         }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement