for(i=a.begin();i!=a.end();i++)
    {
    cin>>*i;    
    }
        for(i=a.begin();i!=a.end();i++)
    {
    cout<<*i; 
    }


above code works fine but when i use while loop to display vector ,  program crash.



while(i!=a.end();)
{
cout<<*i;
i++;
}

What was i initialised to before the loop started? This should work

i=a.begin();
while(i!=a.end())
{
  cout<<*i;
  i++;
}