Advertisement
hopingsteam

Untitled

Apr 25th, 2020
611
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include    <iostream>
  2. #include    <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("bac.txt");
  7.  
  8. int main()
  9. {
  10.     int mat[20][20], n, m;
  11.     fin >> m >> n;
  12.     for(int i = 0; i < n; i++)
  13.         for(int j = 0; j < m; j++)
  14.             fin >> mat[i][j];
  15.  
  16.     int numar = 0;
  17.     for(int i = 0; i < n; i++)
  18.     {
  19.         for(int ii = 0; ii < n; ii++)
  20.         {
  21.             if(mat[i][0] == mat[ii][m - 1])
  22.             {
  23.                 cout << mat[i][0] << " ";
  24.                 numar++;
  25.             }
  26.         }
  27.     }
  28.     if(numar == 0)
  29.         cout << "nepolarizate";
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement