#include <iostream> // std::cout
#include <iterator> // std::ostream_iterator
#include <algorithm> // std::generate, std::remove
#include <vector> // std::vector
#include <ctime> // std::time
#include <cstdlib> // std::rand, std::srand
using namespace std;
int main()
{
//--- создаем и заполняем контейнер случайными данными
std::vector<int> data(5);
std::generate(data.begin(), data.end(), [](){ return (std::rand()%100);} );
//--- выводим в консоль содержимое контейнера
std::cout<<" ---1---\n";
std::copy( data.begin(), data.end(), std::ostream_iterator<int>(std::cout, ", ") );
std::cout<<'\n';
std::cout<<" ---2---\n";
for (size_t i = 0, end = data.size() ; i!=end; ++i)
cout << data[i] << ", ";
std::cout<<'\n';
std::cout<<" ---3---\n";
for (auto i = data.begin(), end = data.end(); i!=end ; ++i)
cout<< *i << ", ";
std::cout<<'\n';
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPiAgICAgLy8gc3RkOjpjb3V0CiNpbmNsdWRlIDxpdGVyYXRvcj4gICAgIC8vIHN0ZDo6b3N0cmVhbV9pdGVyYXRvcgojaW5jbHVkZSA8YWxnb3JpdGhtPiAgICAvLyBzdGQ6OmdlbmVyYXRlLCBzdGQ6OnJlbW92ZQojaW5jbHVkZSA8dmVjdG9yPiAgICAgICAvLyBzdGQ6OnZlY3RvcgojaW5jbHVkZSA8Y3RpbWU+ICAgICAgICAvLyBzdGQ6OnRpbWUKI2luY2x1ZGUgPGNzdGRsaWI+ICAgICAgLy8gc3RkOjpyYW5kLCBzdGQ6OnNyYW5kCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSAKewogICAgLy8tLS0g0YHQvtC30LTQsNC10Lwg0Lgg0LfQsNC/0L7Qu9C90Y/QtdC8INC60L7QvdGC0LXQudC90LXRgCDRgdC70YPRh9Cw0LnQvdGL0LzQuCDQtNCw0L3QvdGL0LzQuCAgICAKICAgIHN0ZDo6dmVjdG9yPGludD4gZGF0YSg1KTsKICAgIHN0ZDo6Z2VuZXJhdGUoZGF0YS5iZWdpbigpLCBkYXRhLmVuZCg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