| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:哪位大哥能帮忙测试一下为什么不对吗?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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator