c/c++ int to string

How to convert int type numbers to string representation in C++? Generally, there are many ways, here we use stream conversion, the code is as follows:




-Cpp code
1
std::string int2str(const int& int_value){
2
    std::stringstream stream;
3
    stream<<int_value;
4
    std::string string_value = stream.str();
5
    return string_value;
6
 
7
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325723454&siteId=291194637