Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void sort(int* &mass, int n)
- {
- for (int i = n - 1; i > 0; i--)
- for (int j = 0; j<i; j++)
- {
- if (mass[j]>mass[j + 1])
- {
- int t = mass[j];
- mass[j] = mass[j + 1];
- mass[j + 1] = t;
- }
- }
- }
- void Oo(int* mass, int n)
- {
- for (int i = 0; i < n; i++)
- cout << mass[i]<<" ";
- cout << endl;
- }
- void main()
- {
- int n, m,n1;
- setlocale(LC_ALL, "rus");
- cout << "введите количество элементов первого массива ";
- cin >> n;
- cout << "введите количество элементов второго массива ";
- cin >> n1;
- int * mass = new int[n];
- int *mass2 = new int[n1];
- cout << "введите множество " << endl;
- for (int i = 0; i < n; i++)
- cin>> mass[i];
- cout << "введите второе множество" << endl;
- for (int j = 0; j < n1; j++)
- cin>> mass2[j];
- cout << "массив 1" << endl;
- Oo(mass, n);
- cout << "массив 2" << endl;
- Oo(mass2, n1);
- sort(mass, n);
- sort(mass2, n1);
- cout << "массив 1 после сортировки" << endl;
- Oo(mass, n);
- cout << "массив 2 после сортировки" << endl;
- Oo(mass2, n1);
- }
Advertisement
Add Comment
Please, Sign In to add comment