Простые типы / Строки

#include <iostream>
using namespace std;

//to int
string strNumber = "42";
int number = stoi(strNumber);

//to Double and Float
string strPi = "3.14";
float pi = stod(strPi);

string strExp = "2.71828";
double exp = stod(strExp);

//replacement of non-standard delimiter
std::string strHalf = "0,5";
size_t index = strHalf.find(","0);
strHalf.replace(index, 1".");
double half = std::stod(strHalf);

cout << "number is " << number << endl;
cout << "p is: " << pi << endl;
cout << "exp is " << exp << endl;
cout << "half is " << half;