标签:
#include<iostream>
using namespace std;
#define Len 3
#include<string>
int main(){
int i,d=1,index=0,box_max=0;
string * pack=new string[Len];
string * p;
pack[0]="http://www.acm.org/";
string comand_s=" ";
do{
cin>>comand_s;
// cout<<comand_s<<endl;
if(comand_s=="VISIT"){
index++;
cin>>pack[index];
cout<<pack[index]<<endl;
box_max=index;
if(index==Len*d-2){
d++;
p=pack;
pack=new string[Len*d];
pack[0]=" ";
for(i=0;i<Len*(d-1);i++){
swap(p[i],pack[i]);
}
delete []p;//////////////////////////最后的调试
// cout<<"------"<<endl; 这招挺管用的
}
}
if(comand_s=="BACK"){
index--;
if(index==-1){
cout<<"Ignored"<<endl;
index++;
}
else
cout<<pack[index]<<endl;
}
if(comand_s=="FORWARD"){
index++;
if(index>box_max){
cout<<"Ignored"<<endl;
index--;
}
else
cout<<pack[index]<<endl;
}
if(comand_s=="QUIT")
return 0;
}while(1);
return 0;
}
标签:
原文地址:http://www.cnblogs.com/gavinsp/p/4563218.html