| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
help~~谁来救救我啊……各位路过的高手~~帮帮我啊~~咋总是wa呢~~不胜感激
#include <iostream>
#include <string>
using namespace std;
int main()
{
string a[500];
string b,d;
int k=0;
a[0]="http://www.acm.org/";
while(cin>>b&&b!="QUIT")
{
if (b=="VISIT")
{
cin>>d;
a[++k]=d;
cout <<a[k]<<endl;
}
else
{
if (b=="BACK"&&k>1)
cout <<a[--k]<<endl;
else
if (b=="BACK"&&k==1)
cout <<a[--k]<<endl;
else
if (b=="FORWARD"&&a[k+1][0]!=NULL)
cout <<a[++k]<<endl;
else cout << "Ignored"<<endl;
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator