Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // polina2-1.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <iostream>
- int main()
- {
- using namespace std;
- const int colCount = 5;
- const int rowCount = 5;
- int mass[colCount][rowCount] = {
- { 1, 1, 1, 1, 1 },
- { 2, 2, 2, 2, 2 },
- { 3, 3, 3, 3, 3 },
- { 1, 1, 1, 1, 1 },
- { 5, 5, 5, 5, 5 },
- };
- int resCount = 0;
- int result[colCount] = { -1, -1, -1, -1, -1 };
- for (int i = 0; i < colCount; i++)
- {
- for (int j = 0; j < rowCount; j++)
- {
- cout << mass[i][j] << ", ";
- }
- cout << endl;
- }
- 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