Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void main() {
- setlocale(LC_ALL, "rus");
- int n, p, schet = 0;
- cout << "введите длину массива #1- "; cin >> n;
- cout << "введите длину массива #2- "; cin >> p;
- int* arr_1 = new int[n];
- int* arr_2 = new int[p];
- cout << "Введите числа 1 массива" << endl;
- for (int q = 0; q < n; q++)
- {
- cin >> arr_1[q];
- }
- cout << "Введите числа 2 массива" << endl;
- for (int q = 0; q < p; q++)
- {
- cin >> arr_2[q];
- }
- cout << "Одинаковые пары:" << endl;
- for (int q = 0; q < n; q++)
- {
- int& l = arr_1[q];
- int m = q;
- for (int t = 0; t < p; t++)
- {
- if (l == arr_2[t])
- {
- cout << m+1 << " - " << t+1 << endl;
- cout << l << " - " << arr_2[t]<<endl;
- cout << "--------------------" << endl;
- schet++;
- }
- }
- }
- cout << "Количество пар - " << schet;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement