zzz
9
Q:

how to turn int into string c++

#include <string> 

std::string s = std::to_string(42);
25
string str_val = to_string(int_val);
3
#include <string>
using namespace std;

int iIntAsInt = 658;
string sIntAsString = to_string(iIntAsInt);
5
// C++ code to demonstrate "to_string()" method 
// to convert number to string. 
#include<iostream> 
#include<string> // for string and to_string() 

    string stri = to_string(i_val); 
    // Conversion of float into string using 
    // to_string() 
    string strf = to_string(f_val); 
  
5
#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);
}
1
std::to_string(23213.123)
6
#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;
}  
1
int x = 5;
string str = to_string(x);
1
// EXAMPLE
int iIntAsInt = 658;
std::string sIntAsString = to_string(iIntAsInt);

/* SYNTAX
to_string(<your-integer>)
*/

/* HEADERS
#include <string>
*/
2

New to Communities?

Join the community