C++ string转int

string s="123";

int a=atoi(s.c_str());

如果string不是数字形式的则转换结果为0。

原文地址:https://www.cnblogs.com/ceerqingting/p/10820801.html