vector c++
#include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<int> v; // create vector
for(int i=0; i<9; i++)
v.push_back(i*i); // add to end
vector<int>::iterator iter; //create iterator
for(iter=v.begin(); iter!=v.end(); iter++)
cout<<*iter<<endl;
if(v.empty())
{
cout<<"vector is empty"<<endl;
}
else
{
cout<<"vector is not empty"<<endl;
}
cout<<"vector deletion from end"<<endl;
for(iter=v.begin(); iter!=v.end()-3; iter++)
v.pop_back();
cout<<"the actual vector"<<endl;
for(int i=0; i<v.size(); i++) // alternative
cout<<v[i]<<endl;
return 0;
}