fork download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. int main() {
  5. int arr[] = { 1,2,3,4,5,3,3,5,4 };
  6. std::sort( std::begin(arr), std::end(arr) );
  7. auto end = std::unique( std::begin(arr), std::end(arr) );
  8. for( auto it = std::begin(arr); it != end; ++it )
  9. std::cout << *it << ' ';
  10. std::cout << std::endl;
  11. return 0;
  12. }
Success #stdin #stdout 0s 4544KB
stdin
Standard input is empty
stdout
1 2 3 4 5