fork download
  1. #include <iostream>
  2. #include<vector>
  3. #include<algorithm>
  4.  
  5. int main () {
  6.  
  7.  
  8. double x[] = {10, 12.5, 12.9, 13.7, 50.07};
  9. size_t length = sizeof(x)/sizeof(x[0]);
  10. std::vector<double> vx(x, x+length);
  11.  
  12. auto it =std::partition(vx.begin(), vx.end(), [](const double & p){ return p <11;});
  13. for(auto i:vx)
  14. std::cout<<i<<" ";
  15. std::cout<<std::endl;
  16.  
  17. it++;
  18. if( it!= vx.end())
  19. std::cout<<"Element :"<<*it;
  20.  
  21. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
10 12.5 12.9 13.7 50.07 
Element :12.9