首页 > 编程 > C++ > 正文

C++编程总结

2019-11-11 06:12:18
字体:
来源:转载
供稿:网友
stringsteam重复使用同一string while (std::getline(files_stream, line)) { std::istringstream ss(line); string s; vector<string> line_buf; while (ss >> s) line_buf.push_back(s);// 这里取出一行string的所有小string ss.clear(); ss.str(line); string name1, name2; int id1, id2; if (line_buf.size() == 3) { ss >> name1 >> id1 >> id2;// 再次使用line这一string } else if (line_buf.size() == 4) { ss >> name1 >> id1 >> name2 >> id2; } }
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选