string to int stl code example
Example 1: string to int c++
// Both functions work identically though you'll need to use "#include <string>"
atoi( str.c_str() );
stoi( str );
Example 2: c++ string to int
// EXAMPLE
std::string sStringAsString = "789";
int iStringAsInt = atoi( sStringAsString.c_str() );
/* SYNTAX
atoi( <your-string>.c_str() )
*/
/* HEADERS
#include <cstring>
#include <string>
*/