Advertisement
rotti321

Tematica matrice [X]

May 5th, 2022
953
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n,a,b,A[101][101]={};
  8. cin>>n>>a>>b;
  9. for(int i=1; i<=n;i++)
  10.     for(int j=1; j<=n; j++)
  11. {
  12.     if(i<a && j<b)
  13.         A[i][j]=1;
  14.     if(i<a && j>b)
  15.         A[i][j]=2;
  16.     if(i>a && j<b)
  17.         A[i][j]=3;
  18.     if(i>a && j>b)
  19.         A[i][j]=4;
  20.  
  21. }
  22. for(int i=1;i<=n;i++){
  23.     for(int j=1;j<=n;j++)
  24.     {
  25.         cout<<A[i][j]<<" ";
  26.     }
  27.     cout<<endl;
  28. }
  29. cout<<endl;
  30. for(int j=1;j<=n;j++){
  31.     for(int i=1;i<=n;i++)
  32.     {
  33.         cout<<A[i][j]<<" ";
  34.     }
  35.     cout<<endl;
  36. }
  37.     return 0;
  38. }
  39. /** Tematica matrice
  40. -> parcurgeri linie/coloana
  41. -> parcurgere matrice linii, coloane
  42. -> generari de matrice
  43. -> gasire min, max, nr de aparitii
  44. */
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement