Standard C++ Library Class Reference
for(iterator i = v1.begin(); i != v1.end(); i++)
cout << *i << " ";
cout << " where N = 10." << endl;
cout << "The sum = (N*N + N)/2 = " << sum << endl;
cout << "The product = N! = " << prod << endl;
return 0;
}
Output :
For the series: 1 2 3 4 5 6 7 8 9 10 where N = 10.
The sum = (N*N + N)/2 = 55
The product = N! = 3628800
Warnings
If your compiler does not support default template parameters then you need to always supply
the Allocator template argument. For instance you'll have to write:
vector<int,allocator>
instead of:
vector<int>