Farjana_akter

Untitled

Feb 17th, 2019
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. string bro[1000];
  4. int main()
  5. {
  6. int n,t,i,j,k;
  7. string s,c;
  8. cin>>t;
  9. for(i=1;i<=t;i++)
  10. {
  11. cout<<"Case "<<i<<":"<<endl;
  12. j=0,k=0;
  13. bro[j]="http://www.lightoj.com/";
  14. while(1){
  15. cin>>c;
  16. if(c=="QUIT")
  17. break;
  18. else if(c=="VISIT")
  19. {
  20. cin>>s;
  21. cout<<s<<endl;
  22. bro[++k]=c;
  23. j=k;
  24. }
  25. else if(c=="BACK")
  26. {
  27. if(k-1<0)
  28. cout<<"Ignored"<<endl;
  29. else
  30. cout<<bro[--k]<<endl;
  31. }
  32. else if(c=="FORWARD")
  33. {
  34. if(k+1>j)
  35. cout<<"Ignored"<<endl;
  36. else
  37. cout<<bro[++k]<<endl;
  38. }
  39. }
  40. }
  41. return 0;
  42. }
Add Comment
Please, Sign In to add comment