64,654
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
int i = 123456;
ostringstream ostr;
ostr << i ;
string str(ostr.str());
cout << str << endl;
return 0;
}
#include <stdio.h>
int main()
{
int i = 123456;
char s[10];
sprintf(s,"%d",i);
printf("%s\n",s);
return 0;
}
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
int a = 10;
ostringstream ostr;
ostr << 10;
string astr = ostr.str();
cout << astr <<endl;
return 0;
}