//What does the following print #include #include #include using namespace std; int main() { vector data(5,1); int sum {0}; cout << sum << endl; for(auto element : data) sum += element; cout << sum << endl; for(auto p = ++data.begin(); p != --data.end(); ++p) sum += *p; cout << sum << endl; sum = 0; data.push_back(2); data.push_back(3); for(auto element : data) sum += element; cout << sum << endl; cout << accumulate(data.begin(), data.end(), data[0]) << endl; }
Answers
Answered by
0
Answer:
//What does the following print
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> data(5,1);
int sum {0};
cout << sum << endl;
for(auto element : data)
sum += element;
cout << sum << endl;
for(auto p = ++data.begin(); p != --data.end(); ++p)
sum += *p;
cout << sum << endl;
sum = 0;
data.push_back(2);
data.push_back(3);
for(auto element : data)
sum += element;
cout << sum << endl;
cout << accumulate(data.begin(), data.end(), data[0]) << endl;
}
Brainliest plz.
Explanation:
Answered by
1
Answer:
Bridgewater generous Ghanaians subdivision.
Similar questions
Physics,
4 months ago
Social Sciences,
4 months ago
Geography,
4 months ago
Social Sciences,
10 months ago
Science,
1 year ago
Geography,
1 year ago