Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<stdio.h>
  3. using namespace std;
  4. int main ()
  5. {
  6.  
  7. int t;
  8. scanf("%d",&t);
  9. int c=0;
  10. char str1[100][100];
  11. char str[100];
  12. for ( int i=1; i<=t; i++)
  13. {
  14. int c=0;
  15. strcpy(str1[++c],"http://www.lightoj.com/");
  16. printf("Case : %d\n",i);
  17.  
  18. while(1)
  19. {
  20. scanf("%s",str);
  21. if (!strcmp(str,"QUIT"))
  22. {
  23. break;
  24. }
  25. if(!strcmp(str,"VISIT"))
  26. {
  27. scanf("%s",str1[++c]);
  28. printf("%s\n",str1[c]);
  29. // printf("%d\n",c);
  30. }
  31. if (!strcmp(str,"BACK"))
  32. {
  33.  
  34. --c;
  35. if (c<=0)
  36. {
  37. printf("Ignored\n");
  38. }
  39. else
  40. printf("%s\n",str1[c]);
  41. }
  42. if (!strcmp(str,"FORWARD"))
  43. {
  44. ++c;
  45. if (c==1)
  46. {
  47. c=2;
  48. }
  49. // printf("%d\n",c);
  50. if (str1[c][0]=='\0')
  51. {
  52. printf("Ignored\n");
  53. }
  54. else
  55. {
  56. printf("%s\n",str1[c]);
  57. }
  58. }
  59.  
  60.  
  61. }
  62. }
  63.  
  64.  
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement