#include<iostream>
#include<vector>
#include<string>
using namespace std;
struct R{
string title;
int rating;
};
bool fillr(R & rr);
void showr(const R & rr);
void main(){
vector<R>books;
R temp;
while(fillr(temp))
books.push_back(temp);
int num=books.size();
cout<<"size::"<<num<<endl;
if(num>0)
{
cout<<"thank you.you entered the following:\n"<<"rating\tbookk\n";
vector<R>::iterator pr;
for(pr=books.begin();pr!=books.end();pr++)
showr(*pr);
vector<R>oldlist(books);
if(num>3){
books.erase(books.begin()+1,books.begin()+3);
cout<<"after erasure:\n";
for(pr=books.begin();pr!=books.end();pr++)
showr(*pr);
books.insert(books.begin(),oldlist.begin()+1,oldlist.begin()+2);
cout<<"atter insertion\n";
for(pr=books.begin();pr!=books.end();pr++)
showr(*pr);
}
books.swap(oldlist);
cout<<"swapping oldlist with bookd:\n";
for(pr=books.begin();pr!=books.end();pr++)
showr(*pr);
}
else
cout<<"bothing entered,nothing gained.\n";
}
bool fillr(R &rr){
cout<<"enter book title(quit to quit):"<<endl;
getline(cin,rr.title);
if(rr.title=="quit")return false;
cout<<"enter book ratingg:";
cin>>rr.rating;
if(!cin)return false;
cin.get();
return true;
}
void showr(const R & rr)
{
cout<<rr.rating<<"\t"<<rr.title<<endl;
}