这是什么原因?要怎么解决啊
#include <iostream>
#include<vector>
#include<string>
#include<map>
#include<utility>
using namespace std;
struct Dir {
int level;
map<string, Dir>kids;
Dir(int l) : level(l) {};
};
void print_dir(Dir& d) {
map<string, Dir>::iterator it;
for (it = d.kids.begin(); it != d.kids.end(); it++) {
for (int i = 0; i < d.level; i++) {
cout << " ";
}
cout << it->first << endl;
print_dir(it->second);
}
}
int main() {
int n;
while (cin >> n && n != 0) {
Dir root(0);
while (n--) {
string s;
cin >> s;
int pos = 0;
int end = 0;
Dir* p = &root;
while (pos < s.size()) {
end = s.find("\\", pos);
if (end == string::npos) {
end = s.length() + 1;
}
string file_name = s.substr(pos, end - pos);
if (p->kids.find(file_name) == p->kids.end()) {
p->kids[file_name] = Dir(p->level + 1);
}
pos = end + 1;
p = &(p->kids[file_name]);
}
print_dir(root);
cout << endl;
}
}
}
// 64 位输出请用 printf("%lld")