Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪位兄弟帮我看一下 啊!!怎么是RUNTIME ERROR

Posted by yangjie at 2005-09-11 17:27:16 on Problem 1028
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator