C++中split怎么定义啊?#include #include #include #include #include "split.h"using std::cin; using std::cout;using std::endl; using std::getline;using std::istream; using std::string;using std::vector; using std::map;mapxref(istream& in,vector fi
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/28 04:44:04
C++中split怎么定义啊?#include #include #include #include #include "split.h"using std::cin; using std::cout;using std::endl; using std::getline;using std::istream; using std::string;using std::vector; using std::map;mapxref(istream& in,vector fi
C++中split怎么定义啊?
#include
#include
#include
#include
#include "split.h"
using std::cin; using std::cout;
using std::endl; using std::getline;
using std::istream; using std::string;
using std::vector; using std::map;
map
xref(istream& in,
vector find_words(const string&) = split)
{
string line;
int line_number = 0;
map ret;
while (getline(in,line)) {
++line_number;
vector words = find_words(line);
#ifdef _MSC_VER
for (std::vector::const_iterator it = words.begin();
#else
for (vector::const_iterator it = words.begin();
#endif
it = words.end(); ++it)
ret[*it].push_back(line_number);
}
return ret;
}
int main()
{
map ret = xref(cin);
#ifdef _MSC_VER
for (std::map::const_iterator it = ret.begin();
#else
for (map::const_iterator it = ret.begin();
#endif
it = ret.end(); ++it) {
cout first second.begin();
#else
vector::const_iterator line_it = it->second.begin();
#endif
cout second.end()) {
cout
C++中split怎么定义啊?#include #include #include #include #include "split.h"using std::cin; using std::cout;using std::endl; using std::getline;using std::istream; using std::string;using std::vector; using std::map;mapxref(istream& in,vector fi
split好像是list容器所特有的啊.
你想干什么呢?
哦,算了我没看清楚题.
你有spih.h这个文件吗?