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 |
帮看看啊!!!不胜感激.#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator