int ke string menggunakan boost :: lexical_cast

#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;  
}
Outrageous Ostrich