xxxxxxxxxx
int a = 10;
stringstream ss;
ss << a;
string str = ss.str();
//cos
xxxxxxxxxx
#include <iostream>
#include<string>
using namespace std;
int main()
{
int i = 11;
float f = 12.3;
string str = to_string(i);
strinf fstr = to_string(f);
}
xxxxxxxxxx
#include <string>
using namespace std;
int iIntAsInt = 658;
string sIntAsString = to_string(iIntAsInt);
xxxxxxxxxx
#include <iostream>
#include<string>
using namespace std;
int main()
{
int i=11;
string str= to_string(i);
cout<<"string value of integer i is :"<<str<<"\n";
return 0;
}
xxxxxxxxxx
#include <string> // important
int main() {
int number = 1250;
std::string numberAsString = std::to_string(number);
// result "1250"
return 0;
}