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

帮看看啊!!!不胜感激.

Posted by qichao at 2009-08-09 16:55:13 on Problem 1028
#include<iostream>
#include<string>
using namespace std;

int main()
{
	int i=0,j=0;
	char str[]="http://www.acm.org/";
	string back[100],s,forward[100];
	string current(str);
	while(cin>>s&&s!="QUIT")
	{
		if(s=="VISIT")
		{
			j=0;
			back[i++]=current;
			cin>>current;
			cout<<current<<endl;
		}
		else if(s=="BACK")
		{
			if(current.compare(str))
				forward[j++]=current;
			if(i>0)
			{
				current=back[--i];
				cout<<current<<endl;
			}
			else
				cout<<"Ignored"<<endl;
		}
		else if(s=="FORWARD")
		{
			back[i++]=current;
			if(j>0)
			{
				current=forward[--j];
				cout<<current<<endl;
			}
			else
				cout<<"Ignored"<<endl;
		}
	}
	return 0;
}

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