#include<iostream>#include<fstream>#include<string>#include<vector>using namespace std;int main() {unsigned int i, j;string filename = "Test.txt";fstream fin;fin.open(filename.c_str(), ios::in);vector<string> v;string tmp;while (fin >> tmp){v.push_back(tmp);}for (i = 0; i < v.size(); i++) {for (j = 0; j < v.size(); j++) {int m = j - 1;if (v[i] == v[j]) v.erase(j-1,j);}}for (auto x : v)cout << x << endl;getchar();getchar();return 0;}
運(yùn)行時報(bào)錯說iterator+offset out range,咋整?
炎炎設(shè)計(jì)
2023-04-23 22:18:32