#include
#include
#include
using namespace std;
double midpoint(double a, double b)
{
return ((a-b) / 2) + b;
}
int main()
{
vector vectorObject1(5), vectorObject2(5), vectorObject3(5);
int i;
vectorObject1[0] = 110.0;
vectorObject1[1] = 918.6;
vectorObject1[2] = 112.23;
vectorObject1[3] = 818.8;
vectorObject1[4] = -212.01;
vectorObject2[0] = 21.0;
vectorObject2[1] = 31.3;
vectorObject2[2] = 41.19;
vectorObject2[3] = 155.0;
vectorObject2[4] = -2.0;
cout << "Values in vectorObject1: ";
for(i = 0; i cout << vectorObject1[ i ] << " ";
cout << endl;
cout << "Values in vectorObject2: ";
for(i = 0; i cout << vectorObject2[ i ] << " ";
cout << endl;
transform(vectorObject1.begin(), // find midpoints between elements in vectorObject1 those in vectorObject2
vectorObject1.end(),
vectorObject2.begin(),
vectorObject3.begin(),
midpoint);
cout << "Midpoints: ";
for(i = 0; i cout << vectorObject3[ i ] << " ";
return 0;
}