KarolWozniak

Zadanie 15 tablice

Apr 16th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int x;
  8.     cout << "Wprowadz rozmiar tablicy kwadratowej: ";
  9.     cin >> x;
  10.     int tab[x][x];
  11.     for(int i=0;i<x;i++)
  12.     {
  13.         for(int j=0;j<x;j++)
  14.         {
  15.             if(i!=j)
  16.             {
  17.                 tab[i][j]=1;
  18.                 cout << tab[i][j];
  19.             }
  20.             else if(i==j)
  21.             {
  22.                 tab[i][j]=0;
  23.                 cout << tab[i][j];
  24.             }
  25.  
  26.         }
  27.         cout << "\n";
  28.     }
  29.     return 0;
  30. }
Add Comment
Please, Sign In to add comment