vector<int> split(string& s, char delim) { vector<int> elems; size_t pos = 0; size_t len = s.length(); while (pos < len) { int find_pos = s.find(delim, pos); if (find_pos < 0) { elems.push_back(atoi(s.substr(pos, len - pos).c_str())); break; } elems.push_back(atoi(s.substr(pos, find_pos - pos).c_str())); pos = find_pos + 1; } return elems; } int main() { char inout_num[1000], delete_num[3]; cin.getline (inout_num, 1000); string tmp(inout_num); vector<int> rec = split(tmp, ' '); ... } 这么干的...
点赞 4

相关推荐

LuvSran:是人我吃。老师就是学校呆久了,就业方面啥都不懂,还自以为是为了我们就业好。我学校就一破双非,计科入行率10%都没有,某老师还天天点名,说是出勤率抬头率前排率高了,华为什么的大厂就会来,我们就是不好好上课才没有厂来招。太搞笑了
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务