Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- int main()
- {
- using namespace std;
- const int colCount = 5;
- const int rowCount = 5;
- int mass[5][5];
- for (int i = 0;i < colCount;i++) {
- for (int j = 0; j < rowCount;j++) {
- cin >> mass[i][j];
- }
- }
- int resCount = 0;
- int result[colCount] = { -1, -1, -1, -1, -1 };
- cout << "------------" << endl;
- for (int i = 0; i < colCount; i++)
- {
- bool found = false;
- for (int j = 0; j < rowCount; j++)
- {
- for (int r = 0; r < resCount; r++)
- {
- if (!memcmp(mass[i], mass[result[r]], rowCount * sizeof(int)))
- {
- found = true;
- break;
- }
- }
- if (found) break;
- }
- if (!found)
- {
- result[resCount] = i;
- resCount++;
- }
- }
- for (int i = 0; i < resCount; i++)
- {
- cout << result[i] << ", ";
- }
- cout << endl << "------------" << endl;
- for (int i = 0; i < resCount; i++)
- {
- for (int j = 0; j < rowCount; j++)
- {
- cout << mass[result[i]][j];
- }
- cout << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement