fork(41) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5. int main ()
  6. {
  7. string pi = "pi is " + to_string(3.1415926);
  8. cout<< "pi = "<< pi << endl;
  9.  
  10. cout<<"to_string is available since "+ to_string(2011) << " so use it!";
  11.  
  12. return 0;
  13. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
pi = pi is 3.141593
to_string is available since 2011 so use it!