Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- int main()
- {
- setlocale(0, "RUSSIAN");
- int n;
- double a;
- cout << "Количество элементов: ";
- cin >> n;
- double *mas = new double[n];
- for (int i = 0; i < n; ++i)
- {
- cout << "Введите " << i + 1 << "-й элемент: ";
- cin >> mas[i];
- }
- cout << "Ввод закончен." << endl << "Введите число, элементы меньше которого будут перемещены в конец: ";
- cin >> a;
- for (int j = 0; j < n; ++j)
- {
- if (mas[j] < a)
- {
- for (int i = 0; i < n-1; ++i)
- {
- swap(mas[i], mas[i + 1]);
- }
- }
- }
- for (int i = 0; i < n; ++i)
- {
- cout << mas[i] << "\t";
- }
- delete[] mas;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement