Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <window.h>
  3. using namespace std;
  4. int_main()
  5. {
  6. char jwb1,jwb2,pil;
  7. ulang :
  8. cout<<“Selamat datang di game GBK”<<endl;
  9. cout<<“peraturan main :<<endl;
  10. cout<<1. G = gunting “<<endl;
  11. cout<<2. B = batu “<<endl;
  12. cout<<3. K = kertas “<<endl<<endl;
  13. cout<<“Player 1 silahkan masukan pilihan anda (G/B/K) =;
  14. cin>>jwb1;
  15. cout<<“Tekan enter untuk lanjut”<<endl;
  16. system(“pause);
  17. system(“cls”);
  18. cout<<“Selamat datang di game GBK”<<endl;
  19. cout<<“peraturan main :<<endl;
  20. cout<<1. G = gunting “<<endl;
  21. cout<<2. B = batu “<<endl;
  22. cout<<3. K = kertas “<<endl<<endl;
  23. cout<<“Player 2 silahkan masukan pilihan anda (G/B/K) =;
  24. cin>>jwb2;
  25. cout<<“Tekan enter untuk lanjut”<<endl;
  26. system(“pause);
  27. system(“cls”);
  28. if (jwb1 == ‘g’ || jwb1 == ‘G’)
  29. {
  30. if (jwb2 == ‘g’ ||jwb2 == ‘G’)
  31. {
  32. cout<<“P1 = Gunting”<<endl;
  33. cout<<“P2 = Gunting”<<endl;
  34. cout<<“Draw”<<endl;
  35. }
  36. if (jwb2 == ‘b’ ||jwb2 == ‘B’)
  37. {
  38. cout<<“P1 = Gunting”<<endl;
  39. cout<<“P2 = Batu”<<endl;
  40. cout<<“P2 win”<<endl;
  41. }
  42. if (jwb2 == ‘k’ ||jwb2 == ‘K’)
  43. {
  44. cout<<“P1 = Gunting”<<endl;
  45. cout<<“P2 = Kertas”<<endl;
  46. cout<<“P1 win”<<endl;
  47. }
  48. }
  49. if (jwb1 == ‘b’ || jwb1 == ‘B’)
  50. {
  51. if (jwb2 == ‘g’ ||jwb2 == ‘G’)
  52. {
  53. cout<<“P1 = Batu”<<endl;
  54. cout<<“P2 = Gunting”<<endl;
  55. cout<<“P1 win”<<endl;
  56. }
  57. if (jwb2 == ‘b’ ||jwb2 == ‘B’)
  58. {
  59. cout<<“P1 = Batu”<<endl;
  60. cout<<“P2 = Batu”<<endl;
  61. cout<<“Draw”<<endl;
  62. }
  63. if (jwb2 == ‘k’ ||jwb2 == ‘K’)
  64. {
  65. cout<<“P1 = Batu”<<endl;
  66. cout<<“P2 = Kertas”<<endl;
  67. cout<<“P2 win”<<endl;
  68. }
  69. }
  70. if (jwb1 == ‘k’ || jwb1 == ‘K’)
  71. {
  72. if (jwb2 == ‘g’ ||jwb2 == ‘G’)
  73. {
  74. cout<<“P1 = Kertas”<<endl;
  75. cout<<“P2 = Gunting”<<endl;
  76. cout<<“P2 win”<<endl;
  77. }
  78. if (jwb2 == ‘b’ ||jwb2 == ‘B’)
  79. {
  80. cout<<“P1 = Kertas”<<endl;
  81. cout<<“P2 = Batu”<<endl;
  82. cout<<“P1 win”<<endl;
  83. }
  84. if (jwb2 == ‘k’ ||jwb2 == ‘K’)
  85. {
  86. cout<<“P1 = Kertas”<<endl;
  87. cout<<“P2 = Kertas”<<endl;
  88. cout<<“Draw”<<endl;
  89. }
  90. }
  91. cout<<endl<<endl;
  92. cout<<“Apakah anda ingin mengulang lagi (Y/N) ?;
  93. cin>>pil;
  94. if(pil==’y’ ||pil==’Y’)
  95. {
  96. goto ulang;
  97. }
  98. if (pil == ‘n’ || pil == ‘N’)
  99. {
  100. cout<<“Terimakasih telah memainkan game GBK”<<endl;
  101. system(“pause”);
  102. return 0;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement