李安灏 2016-07-21 18:02:46
点我顶贴
收藏
删除
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
int m,i,j,k,n,s;
string st,st1[1005];
int main()
{
cin>>st; s=1; m=1;st1[1]="http://www.acm.org/";
while(st!="QUIT")
{
if(st=="VISIT")
{
s++;
cin>>st1[s];cout<<st1[s]<<endl;
m=s;
}
if(st=="FORWARD")
{
if(s<m)
{
s++; cout<<st1[s]<<endl;
}else cout<<"Ignored"<<endl;
}
if(st=="BACK")
{
if(s>1) {s--;cout<<st1[s]<<endl;}else cout<<"Ignored"<<endl;
}
cin>>st;
}
}