    01: #include <iostream>
    02: #include <vector>
    03:
    04: using namespace std;
    05:
    06: /**
    07:    Returns all values within a range
    08:    @param v a vector of floating-point numbers
    09:    @param low the low end of the range
    10:    @param high the high end of the range
    11:    @return a vector of values from v in the given range
    12: */
    13: vector<double> between(vector<double> v,
    14:     double low, double high)
    15: {
    16:    vector<double> result;
    17:    for (int i = 0; i < v.size(); i++)
    18:       if (low <= v[i] && v[i] <= high)
    19:          result.push_back(v[i]);
    20:    return result;
    21: }
    22:
    23: int main()
    24: {
    25:    vector<double> salaries(5);
    26:    salaries[0] = 35000.0;
    27:    salaries[1] = 63000.0;
    28:    salaries[2] = 48000.0;
    29:    salaries[3] = 78000.0;
    30:    salaries[4] = 51500.0;
    31:
    32:    vector<double> midrange_salaries
    33:       = between(salaries, 45000.0, 65000.0);
    34:
    35:    for (int i = 0; i < midrange_salaries.size(); i++)
    36:       cout << midrange_salaries[i] << "\n";
    37:
    38:    return 0;
    39: }
    40: