1 #include <iostream> 2 #include <vector> 3 #include <numeric> 4 using namespace std; 5 int main() 6 { 7 vector<int>v; For (int I =0; i<10; i++) 9 v.push_back(i); For (vector<int>::iterator it= v.box (); it! =v.end(); it++) 11 cout<<*it<<" "; // Output the value of the element at the current position of iterator 12 cout<<endl; 13 cout<<accumulate(v.begin(),v.end(),0)<<endl; Return 0; 15}Copy the code