double to string c 2b 2b

Solutions on MaxInterview for double to string c 2b 2b by the best coders in the world

showing results for - "double to string c 2b 2b"
Amy
05 Jul 2019
1std::ostringstream strs;
2strs << dbl;
3std::string str = strs.str();
Alissa
24 Jan 2018
1// to_string example
2#include <iostream>   // std::cout
3#include <string>     // std::string, std::to_string
4
5int main ()
6{
7  std::string pi = "pi is " + std::to_string(3.1415926);
8  std::string perfect = std::to_string(1+2+4+7+14) + " is a perfect number";
9  std::cout << pi << '\n';
10  std::cout << perfect << '\n';
11  return 0;
12}