best way to convert string to a mnumber c++ code example
Example 1: convert stirng to int c++
int thing = std::stoi(string);
Example 2: convert string to number c++
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string str = "123456";
int n;
stringstream ( str ) >> n;
cout << n; //Output:123456
return 0;
}