#include <iostream>
#include <vector>
using namespace std;
int main( ) {
vector< int > vetor;
int i;
// INSERINDO 5 VALORES DE 1 A 5 USANDO PUSH_BACK
for ( i = 0 ; i < 5 ; i++ ) {
vetor.push_back ( i) ;
}
// PEGANDO O TAMANHO DO VETOR
cout << "Tamanho do Vetor = " << vetor.size ( ) << endl;
// ACESSANDO OS 5 VALORES DO VETOR PASSANDO PELO INDEX
for ( i = 0 ; i < 5 ; i++ ) {
cout << "Valor do vetor [" << i << "] = " << vetor[ i] << endl;
}
// OU USANDO O ITERATOR PARA ACESSAR OS VALORES.
vector< int > :: iterator v = vetor.begin ( ) ;
while ( v ! = vetor.end ( ) ) {
cout << "Valor do vetor = " << * v << endl;
v++ ;
}
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKXsKCiAgICB2ZWN0b3I8aW50PiB2ZXRvcjsKICAgIGludCBpOwoKICAgIC8vIElOU0VSSU5ETyA1IFZBTE9SRVMgREUgMSBBIDUgIFVTQU5ETyBQVVNIX0JBQ0sKICAgZm9yKGkgPSAwOyBpIDwgNTsgaSsrKXsKICAgICAgdmV0b3IucHVzaF9iYWNrKGkpOwogICB9CiAgICAvLyBQRUdBTkRPIE8gVEFNQU5ITyBETyBWRVRPUgogICAgY291dCA8PCAiVGFtYW5obyBkbyBWZXRvciA9ICIgPDwgdmV0b3Iuc2l6ZSgpIDw8IGVuZGw7CgogICAgLy8gQUNFU1NBTkRPIE9TIDUgVkFMT1JFUyBETyBWRVRPUiBQQVNTQU5ETyBQRUxPIElOREVYCiAgICBmb3IoaSA9IDA7IGkgPCA1OyBpKyspewogICAgICBjb3V0IDw8ICJWYWxvciBkbyB2ZXRvciBbIiA8PCBpIDw8ICJdID0gIiA8PCB2ZXRvcltpXSA8PCBlbmRsOwogICB9CgogICAvLyBPVSBVU0FORE8gTyBJVEVSQVRPUiBQQVJBIEFDRVNTQVIgT1MgVkFMT1JFUy4KICAgdmVjdG9yPGludD46Oml0ZXJhdG9yIHYgPSB2ZXRvci5iZWdpbigpOwogICB3aGlsZSggdiAhPSB2ZXRvci5lbmQoKSkgewogICAgICBjb3V0IDw8ICJWYWxvciBkbyB2ZXRvciA9ICIgPDwgKnYgPDwgZW5kbDsKICAgICAgdisrOwogICB9CiAgICByZXR1cm4gMDsKfQo=