Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,columns,rows;
- cout << "Enter the number of users: ";
- cin >> n;
- int* array = new int[n];
- for (size_t i = 0; i < n; i++)
- {
- do
- {
- cout << "Enter the person number " << i + 1 << "'s last 4 digits: ";
- cin >> array[i];
- } while (array[i] <1000 || array[i] > 9999);
- }
- int matrix[100][100] = { 0 };
- cout << "Enter the number of columns: ";
- cin >> columns;
- cout << "Enter the number of rows: ";
- cin >> rows;
- int counter = 0;
- for (size_t i = 0; i < rows; i++)
- {
- for (size_t j = 0; j < columns; j++)
- {
- if (counter < n)
- {
- matrix[i][j] = array[counter];
- counter++;
- }
- }
- }
- for (size_t i = 0; i < rows; i++)
- {
- cout << endl;
- for (size_t j = 0; j < columns; j++)
- {
- if (matrix[i][j] == 0)
- cout << "000";
- cout << matrix[i][j] << " ";
- }
- }
- cout << endl;
- bool isIdentical = false;
- for (size_t i = 0; i < columns; i++)
- {
- for (size_t j = 0; j < rows; j++)
- {
- isIdentical = false;
- int countingRows = 1;
- while (countingRows <= rows - j)
- {
- if (matrix[j][i] != 0 && matrix[j][i] == matrix[j][countingRows])
- {
- isIdentical = true;
- break;
- cout << "aaa";
- }
- countingRows++;
- }
- }
- cout << isIdentical << " ";
- }
- delete[] array;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement