给你一个分割字符串形式的数组的神器. vector<int> getvec(string str){ vector<int> vec; string temp = ""; for(int i=0;i<str.length();++i){ if(!isdigit(str[i])){ if(temp.size() > 0) vec.push_back(toint(temp)); temp = ""; } else temp += str[i]; } if(temp.size() > 0) vec.push_back(toint(temp)); return vec; }
点赞 3
牛客网
牛客网在线编程
牛客网题解
牛客企业服务