c++ int parse string code example
Example 1: c++ parse int
std::string s = "10";
int i = std::stoi(s);
Example 2: c++ string to integer without stoi
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string s = "999";
stringstream degree(s);
int x = 0;
degree >> x;
cout << "Value of x: " << x;
}