6.3w+
社区成员
#include "iostream"
#include "string"
using namespace std;
string int2str(int n) {
char t[24];
int i = 0;
while (n) {
t[i++] = (n % 10) + '0';
n /= 10;
}
t[i] = 0;
return string(strrev(t));
}
int main() {
int n = 1312355;
string str = int2str(n);
cout<<str<<endl;
return 0;
}
#include <strstream>
strstream ss;
换成
#include <sstream>
stringstream ss;
char buf[10];
sprintf(buf, "%d", 100);
string b = buf;