daily pastebin goal
23%
SHARE
TWEET

Untitled

Farjana_akter Feb 17th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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>>c;
  21.                cout<<c<<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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top