27 lines
554 B
C++
27 lines
554 B
C++
#include "default_parameters.hpp"
|
|
|
|
#include <cmath>
|
|
#include <sstream>
|
|
|
|
namespace functions {
|
|
|
|
auto repeat(const char ch, const int count) -> std::string {
|
|
std::ostringstream oss;
|
|
for (int i = 0; i < count; i++) {
|
|
oss << ch;
|
|
}
|
|
return oss.str();
|
|
}
|
|
|
|
auto power(const int base, const int exponent) -> long long {
|
|
return std::pow(base, exponent);
|
|
}
|
|
|
|
auto clamp(const int value, const int min, const int max) -> int {
|
|
if (value < min) return min;
|
|
if (value > max) return max;
|
|
return value;
|
|
}
|
|
|
|
} // namespace functions
|