how to convert string to int in c++

include

include

include

int main() { std::string str_num = "12345"; int int_num; std::stringstream(str_num) >> int_num; std::cout << "The integer value is: " << int_num << std::endl; return 0; }