poj 1028 Web Navigation

2014-11-24 09:42:25 · 作者: · 浏览: 0

#include
#include
#include
using namespace std;
int main(){
string input;
string url;
stack past;
stack future;
past.push("http://www.acm.org/");
/*
past.push("hello1");
past.push("hello2");
cout< past.pop();
cout< */
while(cin>>input){
if(input[0]=='B'){
//cout<<"BACK"< if(past.size()<=1){
cout<<"Ignored"< }
else{
future.push(past.top());
past.pop();
cout<

}
}
else if(input[0]=='F'){
//cout<<"FORWARD"< if(future.empty()){
cout<<"Ignored"< }
else{
cout< past.push(future.top());
future.pop();
}
}
else if(input[0]=='V'){
//cout<<"VISIT"< cin>>url;
past.push(url);
cout< while(!future.empty()){
future.pop();
}
}
else if(input[0]=='Q'){
//cout<<"QUIT"< }

}
return 0;