#include <iostream>
#include <vector>
using namespace std;
struct Track {
int num;
};
vector<Track> sort_track(vector<Track> dets) {
cout << "-------" << endl;
for (int i = 0; i < dets.size(); i++) {
cout << dets[i].num << endl;
}
//cout << dets.size() << endl;
vector<Track> vtrack;
for (int i = 0; i < dets.size(); i++) {
for (int j = i + 1; j < dets.size(); j++) {
if (dets[i].num == dets[j].num) {
dets.erase(dets.begin() + j);
}
}
}
cout << "---------" << endl;
for (int i = 0; i < dets.size(); i++) {
cout << dets[i].num << endl;
}
return dets;
}
int main()
{
vector<Track> track;
Track t1, t2, t3, t4;
t1.num = 1;
t2.num = 2;
t3.num = 2;
t4.num = 1;
track.push_back(t1);
track.push_back(t2);
track.push_back(t3);
track.push_back(t4);
cout << track.size() << endl;
auto result = sort_track(track);
//std::cout << "Hello World!\n";
}
|