fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. int numElements;
  7. int lowerBound;
  8. int upperBound;
  9.  
  10. cin >> numElements;
  11.  
  12. vector<int> numInts(numElements);
  13. for(int i = 0; i < numElements; ++i) {
  14. cin >> numInts.at(i);
  15. }
  16. cin >> lowerBound;
  17. cin >> upperBound;
  18.  
  19. for(int i = 0; i < numElements; ++i) {
  20. if(numInts.at(i) >= lowerBound && numInts.at(i) <= upperBound) {
  21. cout << numInts.at(i) << ",";
  22. }
  23. }
  24.  
  25. cout << endl;
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5284KB
stdin
5
25 51 0 200 33
25 
51
stdout
25,51,33,