| ||||||||||
| 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 | |||||||||
哪位兄弟帮我看一下 啊!!怎么是RUNTIME ERROR#include <iostream>
#include <string>
using namespace std;
int main()
{
string A[500];
string B;
int j(0),i(0);
A[0]="http://www.acm.org/";
for(j=1;j<500;j++)
A[j]="ab";
for(i=1;;i++)
{
cin>>B;
if(B=="VISIT")
{
cin>>A[i];
cout<<A[i]<<endl;
}
if(B=="BACK")
{
if(A[i-1]=="http://www.acm.org/")
{cout<<"ignored"<<endl;i=i-2;}
else if(A[i-2]!="ab"&&i>=2)
{ cout<<A[i-2]<<endl;i=i-2;}
else if(i<2)
cout<<"ignored"<<endl;
}
if(B=="FORWARD")
{
if(A[i-1]=="http://www.acm.org/"&&A[i]=="ab")
cout<<"ignored"<<endl;
else if(A[i]=="http://www.acm.org/"&&A[i+1]!="ab")
{cout<<A[i+1]<<endl;i=i+1;}
else if(A[i]!="ab")
cout<<A[i]<<endl;
else
cout<<"ignored"<<endl;
}
if(B=="QUIT")
{
break;
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator