#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main()
{
vector<int> vectorObject(5), vectorObject2(5);
int i;
for(i = 0; i < 5; i++)
vectorObject[i] = i;
cout << "Original sequence: ";
for(i = 0; i <5; i++)
cout << vectorObject[i] << " ";
cout << endl;
partial_sum(vectorObject.begin(), vectorObject.end(), vectorObject2.begin());
cout << "Resulting sequence: ";
for(i = 0; i < 5; i++)
cout << vectorObject2[ i ] << " ";
return 0;
}
|