Okay, so my homework assignment states, "use the for_each algorithm to print out the contents of a vector of doubles using the display function." Here is what i have, but how do i get it to send a double to display when all i have is a vector of doubles?
Thanks
Code:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void display (double n);
int main()
{
vector<double> numbers;
for_each(numbers.begin(), numbers.end(), display(/*what goes here*/));
return 0;
}
void display (double n)
{
cout << n << endl;
}