C++ string转int

string s="123";

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

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

posted @ 2019-05-06 17:14  侧耳倾听Zx  阅读(4252)  评论(0编辑  收藏  举报