Question : int to string Using boost::lexical_cast
Answered by : softhunt
#include <iostream>
#include <boost/lexical_cast.hpp>
using namespace std;
int main() { // a variable of int data type int num = 05; // a variable of str data type string str; // using boost::lexical_cast<string> to convert an int into a string str = boost::lexical_cast<string>(num); cout << "The integer value is " << num << endl; cout << "The string representation of the integer is " << str << endl;
}
Source : https://softhunt.net/how-to-convert-int-to-string-c/ | Last Update : Tue, 17 May 22