Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

to_string c++

// to_string example
#include <iostream>   // std::cout
#include <string>     // std::string, std::to_string

int main ()
{
  std::string pi = "pi is " + std::to_string(3.1415926);
  std::string perfect = std::to_string(1+2+4+7+14) + " is a perfect number";
  std::cout << pi << '
';
  std::cout << perfect << '
';
  return 0;
}
Source by www.cplusplus.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
4+5 =