#include
#include
#include
#include
#include
int main()
{
std::array arr;
std::generate(arr.begin(), arr.end(), []()
{
return 1 + std::rand() % 100;
});
std::copy(arr.begin(), arr.end(),
std::ostream_iterator(std::cout, " "));
std::cout << std::endl << std::accumulate(arr.begin(), arr.end()-3, 0) << std::endl;</p>
std::cout << std::accumulate(arr.begin(), arr.end()-2, 0) << std::endl;</p>
std::cout << std::accumulate(arr.begin(), arr.end()-1, 0) << std::endl;</p>
std::cout << std::accumulate(arr.begin(), arr.end(), 0) << std::endl;</p>
}