手掌心
c++的标准作法是通过stringstream。1234567891011121314151617181920#include <iostream>#include <sstream>#include <string> using namespace std; int main(int argc, char const *argv[]){ stringstream ss; string str; int i = 1; float f = 10.1; double d = 100.11; ss << i << "," << f << "," << d << endl; ss >> str; cout << str; return 0;}运行:11,10.1,100.11