Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <iostream>
- #include <random>
- #include <chrono>
- #include <iomanip>
- #include <string>
- std::random_device rd;
- std::mt19937::result_type seed = rd() ^ (
- (std::mt19937::result_type)
- std::chrono::duration_cast<std::chrono::seconds>(
- std::chrono::system_clock::now().time_since_epoch()
- ).count() +
- (std::mt19937::result_type)
- std::chrono::duration_cast<std::chrono::microseconds>(
- std::chrono::high_resolution_clock::now().time_since_epoch()
- ).count());
- std::mt19937 gen(seed);
- __forceinline unsigned int randint(int min, int max) {
- std::uniform_int_distribution<unsigned> distrib(min, max);
- return distrib(gen);
- }
- int main()
- {
- setlocale(LC_ALL, "RUS");
- unsigned char max_nums;
- max_nums |= (unsigned long long) - 1;
- std::vector<float>arr_more_zero;
- std::vector<float>arr_less_zero;
- std::vector<std::wstring>sorted_out;
- for (int i = 0; i < max_nums; ++i) {
- float buf = cos(randint(180, 360));
- if (buf > 0)
- arr_more_zero.push_back(buf);
- else
- arr_less_zero.push_back(buf);
- }
- std::sort(arr_more_zero.begin(), arr_more_zero.end(), std::less <float>());
- std::sort(arr_less_zero.begin(), arr_less_zero.end(), std::greater<float>());
- for (int i = 0; i < max_nums; ++i)
- if (arr_less_zero.size() > 1 and arr_more_zero.size() > 1) {
- sorted_out.push_back(std::wstring(L"Случайное положительное: ")
- + std::wstring(std::to_wstring(arr_more_zero[arr_more_zero.size() - 1]))
- + std::wstring(L" Случайное отрицательное : ") + std::wstring(std::to_wstring(arr_less_zero[arr_less_zero.size() - 1])));
- arr_less_zero.pop_back(); arr_more_zero.pop_back();
- }
- for (auto i : sorted_out)
- std::wcout << i << std::endl;
- }
- Это пиздец блядь!!!
Add Comment
Please, Sign In to add comment