RGB To Hex Conversion Time : Space : 123456789101112131415class RGBToHex{public: static std::string rgb(int r, int g, int b);};std::string hex(int x) { x = std::clamp(x,0,255); auto toChar = [](int x) -> char { return x >= 10 ? 'A' + x - 10 : '0' + x; }; return std::string{toChar(x / 16), toChar(x % 16)};}std::string RGBToHex::rgb(int r, int g, int b) { return hex(r) + hex(g) + hex(b);}