MarcinKrol

Zad 15

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