int num = 123; std::string str_num = std::to_string(num); // converts 123 to "123"
float num = 3.14; std::string str_num = std::to_string(num); // converts 3.14 to "3.140000"
double num = 3.14159265358979323846; std::string str_num = std::to_string(num); // converts 3.14159265358979323846 to "3.141593"The std::to_string function is a part of the C++ Standard Library which is included in all C++ compilers and does not require any additional package or library to be installed.