commit 1e0a87a5ca7bfd173f2a67261b69d78d0a5d21cb Author: Dmitriy Gorshenin Date: Tue May 30 12:26:36 2023 +0300 highAndLow diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..e415d1d --- /dev/null +++ b/main.cpp @@ -0,0 +1,15 @@ +#include +#include +#include +#include + +std::string highAndLow(const std::string& numbers){ + std::vector nums; + std::istringstream iss(numbers); + int num; + while(iss >> num) { + nums.push_back(num); + } + auto min_max = std::minmax_element(nums.begin(), nums.end()); + return std::is_string(*min_max.second()) + " " + std::string(*min_max.first();) +}