fork download
  1. #include <vector>
  2. #include <iostream>
  3. #include <iterator>
  4. #include <algorithm>
  5.  
  6. int main() {
  7.  
  8. // Open the file
  9. // std::ifstream file_in("/FilePath.../checkIn.dat");
  10.  
  11. // Create the vector, initialized from the numbers in the file:
  12. std::vector<double> fileData((std::istream_iterator<double>(std::cin)),
  13. std::istream_iterator<double>());
  14.  
  15. std::sort(fileData.begin(), fileData.end());
  16. std::copy(fileData.begin(), fileData.end(),
  17. std::ostream_iterator<double>(std::cout, "\n"));
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 3024KB
stdin
2000 1 1225.72 1 463.81 3 200 1 632 2 1500 1 300 2 1800
stdout
1
1
1
1
2
2
3
200
300
463.81
632
1225.72
1500
1800
2000