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

Re:哪位大哥能帮忙测试一下为什么不对吗?

Posted by lingmao at 2007-05-18 10:04:59 on Problem 1028
In Reply To:哪位大哥能帮忙测试一下为什么不对吗? Posted by:freefly at 2007-05-17 23:55:47
> #include<iostream>
> #include<cstring>
> using namespace std;
> int main()
> {
> 	char str[105][75],str1[10],str2[75];
> 	strcpy(str[0],"http://www.acm.org/");
> 	int n=0,j=0;
> 	while(cin>>str1)
> 	{
> 		if(strcmp(str1,"QUIT")==0)break;
> 		if(strcmp(str1,"VISIT")==0)
> 		{
> 					
> 			cin>>str2;
> 			if(n==j)
> 			{n++;j++;
> 				strcpy(str[n],str2);
> 			cout<<str[n]<<endl;
> 			}
> 			else if(n<j)
> 			{
> 				n++;
> 				strcpy(str[n],str2);
> 				cout<<str[n]<<endl;
> 			}
> 			
> 			cout<<n<<" "<<j<<endl;
> 		}
> 		else if(strcmp(str1,"BACK")==0)
> 		{
> 			n--;
> 			if(n<0){n=0;
> 				cout<<"Ignored"<<endl;
> 			}
> 			else cout<<str[n]<<endl;
> 		}
> 		else if(strcmp(str1,"FORWARD")==0)
> 		{
> 			n++;
> 			if(n>j){n=j;
> 				cout<<"Ignored"<<endl;
> 			}
> 			else cout<<str[n]<<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