原文链接:https://blog.csdn.net/wusecaiyun/article/details/48049439
化为int,有两种方式:
string s = “123”;
int c = atoi(s.c_str());
或者
int c = stoi(s);
将string转化为double,也是两种方式。
string s = “123.5”;
double c = atof(s.c_str())
或者
double c = stod(s);
扫描二维码关注公众号,回复:
10650334 查看本文章
![](/qrcode.jpg)