C++int转字符串

C++int转字符串


#include <iostream>
#include <sstream>

using namespace std;

string intToString(int n)
{
    ostringstream stream;
    stream << n;
    return stream.str();
}

int main()
{
    string s = "字符串转数字:" + intToString(54321);
    cout << s << endl;
    return 0;
}

猜你喜欢

转载自blog.csdn.net/lly1122334/article/details/54144180