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

哪位牛人帮我看看啊,怎么老WA啊?

Posted by 0710321109 at 2009-02-24 23:16:14 on Problem 1028
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string w[120],m;
	int i=0,s=0;
	w[0]="http://www.acm.org/";
	while(cin>>m&&m!="QUIT")
	{
		
		if(m=="VISIT")
		{
			i++;
			cin>>w[i];
			cout<<w[i]<<endl;
			s=i;
		}
		if(m=="BACK")
		{
			i--;
			if(i>=0)
				cout<<w[i]<<endl;
			else
			{
				i++;
				cout<<"Ignored"<<endl;
			}
		}
		if(m=="FORWARD")
		{
			i++;
			if(i<=s)
				cout<<w[i]<<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