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

虽然是AC代码,但我对CONTINUE的用法十分疑惑了,大牛帮帮忙!!!!

Posted by lijingwei at 2010-08-25 11:21:45 on Problem 1028
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	char a[120],b[200][120],len[120];
	int max,j,i=1;
	while(gets(a))
	{
		if(strcmp(a,"QUIT")==0)
			break;
		if(strcmp(a,"BACK")==0)
		{
			i--;
			if(i>1)
			{
				for(j=0;j<len[i];j++)
					cout<<b[i][j];
				cout<<endl;	
				continue;//去掉应该没错吧?但是实际上RE
			}
			else
				if(i<1)
				{
					i=1;
					printf("Ignored\n");
					continue;//去掉没错吧?我电脑运行会有乱码!!
				}
				else
				{
					printf("http://www.acm.org/\n");
					continue;//下面continue问题同上
				}
		}
		if(strcmp(a,"FORWARD")==0)
		{
			i++;
			if(i>max)
			{
				i=max;
				printf("Ignored\n");
				continue;
			}
			else
			{
				if(i>=2)
				{
					for(j=0;j<len[i];j++)
						cout<<b[i][j];
					cout<<endl;
				}
				if(i==1)
                	printf("http://www.acm.org/\n");
			}
		}
		else
		{
			i++;
			for(j=0;j<strlen(a)-6;j++)
			{
				b[i][j]=a[j+6];
				cout<<b[i][j];
			}
			len[i]=strlen(a)-6;
			cout<<endl;
			max=i;
		}
	}
	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