Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

int to string Using to_string method

#include <iostream>
#include<string>  
using namespace std;

int main() {
  int num = 05; // a variable of int data type

  string str; // a variable of str data type

  // using to_string to convert an int into a string
  str = to_string(num);

  cout << "The integer value is " << num << endl;  
  cout << "The string representation of the integer is " << str << endl;  
}
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #int #string #Using #method
ADD COMMENT
Topic
Name
2+2 =