#include<bits/stdc++.h>
using namespace std;
int main(){
//===============( defining iterator )================
vector<int> a={2,4,3,6,7,8};
vector<int> :: iterator i;
for(i=a.begin();i!=a.end();i++){
cout<< *i<<" "; // *i -> a[i] (dereferencing)
}
cout<<endl;
//===================( using auto )===================
for(auto j=a.begin();j!=a.end();j++){
cout<< *j<<" ";
}
cout<<endl;
//==================( i'th index element using itearaor )============
cout<<"Element at 4th index is: "<< *(a.begin()+4)<<endl; // *(i)=a[i]
cout<<"Last element: "<< *(a.begin()+a.size()-1)<<endl;
//===================( using "for each" in loops )==============
for(auto z:a){ // for each element in a
cout<<z<<" "; // z=a[i]
}
cout<<endl;
return 0;
}