C/C++

Помогите с С++ пожалуйста

Контейнер Тип элементов Задание 1 Задание 2 Задание 3

Дим Ооо Юеи
Дим Ооо Юеи
483
// 1 задание
#include <iostream>
#include <set>
#include <random>
using namespace std;
int main() {
uniform_int_distribution<> uid(10, 25);
mt19937 gen{ random_device()() };
const auto n = 15U;
multiset<int> box;
for (auto i = 0U; i < n; ++i) box.emplace(uid(gen));
for (auto& x : box) cout << x << ' ';
puts("");
box.erase(box.begin());
for (auto& x : box) cout << x << ' ';
puts("");
system("pause > nul");
}

// 2 задание
#include <iostream>
#include <set>
#include <random>
using namespace std;
int main() {
uniform_int_distribution<> uid(10, 25);
mt19937 gen{ random_device()() };
const auto n = 15U;
multiset<int, greater<>> box;
for (auto i = 0U; i < n; ++i) box.emplace(uid(gen));
for (auto& x : box) cout << x << ' ';
puts("");
box.erase(box.begin());
for (auto& x : box) cout << x << ' ';
puts("");
system("pause > nul");
}

// 3 задание
#include <algorithm>
#include <iostream>
#include <set>
#include <random>
#include <iomanip>
using namespace std;
int main() {
uniform_int_distribution<> uid(10, 25);
mt19937 gen{ random_device()() };
const auto n = 15U;
multiset<int> box;
for (auto i = 0U; i < n; ++i) box.emplace(uid(gen));
for (auto& x : box) cout << setw(5) << x << ' ';
puts("");
auto [pmin, pmax] = minmax_element(box.begin(), box.end());
auto sub = *pmax - *pmin;
cout << " max: " << *pmax << "\n min: " << *pmin << "\n difference: " << sub << '\n';
multiset<int> tmp;
for (auto& x : box) tmp.emplace(x - sub);
box = tmp;
for (auto& x : box) cout << setw(5) << x << ' ';
puts("");
system("pause > nul");
}
Арслан *
Арслан *
63 843
Лучший ответ
Дим Ооо Юеи mojno без auto пожалуйста, заменить