1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
#include <array>
#include <algorithm>
int main()
{
const int j = 5;
std::string array[j][47] = {{"wall","brick","stone","first"},
{"wall","brick","stone","first"},
{"wall","brick","stone","six"},
{"wall","brick","stone","first"},
{"wall","brick","stone","duo"}};
std::array<std::string, j> temp, out;
for(int i = 0; i < j; ++i){
temp[i] = array[i][3];
}
std::sort(temp.begin(), temp.end());
auto last = std::unique_copy(temp.begin(), temp.end(), out.begin());
for(auto i = out.begin(); i != last; ++i)
std::cout << *i << " ";
return 0;
}
|