asfeixue 2010-07-31 19:27:00
点我顶贴
收藏
删除
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str[10000];
str[0]="http://www.acm.org/";
string S;
cin>>S;
int i=0,j=0; //i表示当前位置,j表示
while(S!="QUIT")
{
if(S=="VISIT")
{
i++;
j=i;
cin>>str[i];
cout<<str[i]<<endl;
}
if(S=="BACK")
if(i==0)
cout<<"Ignored"<<endl;
else
{
i--;
cout<<str[i]<<endl;
}
if(S=="FORWARD")
if(i==j)
cout<<"Ignored"<<endl;
else
{
i++;
cout<<str[i]<<endl;
}
cin>>S;
}
return 0;
}
