Advertisement
fabis_sparks

ver22

Apr 3rd, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3.  
  4.  
  5. int main()
  6. {
  7.     using namespace std;
  8.     const int colCount = 5;
  9.     const int rowCount = 5;
  10.  
  11.     int mass[5][5];
  12.     for (int i = 0;i < colCount;i++) {
  13.         for (int j = 0; j < rowCount;j++) {
  14.             cin >> mass[i][j];
  15.         }
  16.     }
  17.     int resCount = 0;
  18.     int result[colCount] = { -1, -1, -1, -1, -1 };
  19.  
  20.     cout << "------------" << endl;
  21.  
  22.     for (int i = 0; i < colCount; i++)
  23.     {
  24.         bool found = false;
  25.  
  26.         for (int j = 0; j < rowCount; j++)
  27.         {
  28.             for (int r = 0; r < resCount; r++)
  29.             {
  30.                 if (!memcmp(mass[i], mass[result[r]], rowCount * sizeof(int)))
  31.                 {
  32.                     found = true;
  33.                     break;
  34.                 }
  35.             }
  36.             if (found) break;
  37.         }
  38.  
  39.         if (!found)
  40.         {
  41.             result[resCount] = i;
  42.             resCount++;
  43.         }
  44.     }
  45.  
  46.     for (int i = 0; i < resCount; i++)
  47.     {
  48.         cout << result[i] << ", ";
  49.     }
  50.     cout << endl << "------------" << endl;
  51.  
  52.     for (int i = 0; i < resCount; i++)
  53.     {
  54.         for (int j = 0; j < rowCount; j++)
  55.         {
  56.             cout << mass[result[i]][j];
  57.         }
  58.         cout << endl;
  59.     }
  60.  
  61.  
  62.     system("pause");
  63.     return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement