#include <iostream> #include <sstream> using namespace std; int main() { string a; int b; stringstream c; cin.getline(a); c<<a; c>>b; cout<<b<<endl; cout<<b+1<<endl; return 0; }
C++用sstream将string转化为int
原文:https://www.cnblogs.com/deadpool520/p/11055379.html