#include <iostream>
#include <vector>
using namespace std;
vector<double> between(vector<double> v,
double low, double high)
{
vector<double> result;
for (int i = 0; i < v.size(); i++)
if (low <= v[i] && v[i] <= high)
result.push_back(v[i]);
return result;
}
int main()
{
vector<double> salaries(5);
salaries[0] = 35.0;
salaries[1] = 63.0;
salaries[2] = 48.0;
salaries[3] = 78.0;
salaries[4] = 51.0;
vector<double> midrange_salaries = between(salaries, 45.0, 65.0);
for (int i = 0; i < midrange_salaries.size(); i++)
cout << midrange_salaries[i] << "\n";
return 0;
}
|