推荐使用C++标准库作法:

#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main()
{
    int a = 2;
    string b = "abc";
    stringstream ss;
    ss << a << b;
    cout << ss.str() << endl;
    return 0;
}

  

转载于:https://www.cnblogs.com/daocaowu/archive/2013/06/15/3138131.html

Logo

GitCode AI社区是一款由 GitCode 团队打造的智能助手,AI大模型社区、提供国内外头部大模型及数据集服务。

更多推荐