Advertisement
Guest User

rock paper fuck 3

a guest
Feb 20th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <time.h>
  5. #include <string>
  6.  
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.  
  13. string choice;
  14.  
  15. int computer;
  16.  
  17. cout << "Rock, Paper, or Scissors?" << endl;
  18. cout << " " << endl;
  19.  
  20. cin >> choice;
  21.  
  22. if (choice == "Rock" || choice == "Paper" || choice == "Scissors")
  23.  
  24. {
  25. cout << "You chose " << choice << endl;
  26. }
  27. else if (choice != "Rock" || choice != "Paper" || choice != "Scissors")
  28.  
  29. {
  30. cout << "That's not a valid choice. Please try again." << endl;
  31. }
  32. srand(time(NULL));
  33.  
  34. computer = rand() % 3 + 1;
  35.  
  36. if (computer == 1)
  37. {
  38. cout << "Computer chose rock." << endl;
  39. }
  40. else if (computer == 2)
  41. {
  42. cout << "Computer chose paper." << endl;
  43. }
  44. else if (computer == 3)
  45. {
  46. cout << "Computer chose Scissors." << endl;
  47. }
  48.  
  49. //Who won
  50. //Rock
  51.  
  52. if (choice == "Rock" && computer == 1)
  53. {
  54. cout << "It's a tie!" << endl;
  55. cin.get();
  56. }
  57. else if (choice == "Rock" && computer == 2)
  58. {
  59. cout << "You lose kek" << endl;
  60. cin.get();
  61. }
  62. else if (choice == "Rock" && computer == 3)
  63. {
  64. cout << "You win" << endl;
  65. cin.get();
  66. }
  67.  
  68.  
  69. //paper
  70. if (choice == "Paper" && computer == 2)
  71. {
  72. cout << "It's a tie!" << endl;
  73. cin.get();
  74. }
  75. else if (choice == "Paper" && computer == 3)
  76. {
  77. cout << "You lose kek" << endl;
  78. cin.get();
  79. }
  80. else if (choice == "Paper" && computer == 1)
  81. {
  82. cout << "You win" << endl;
  83. cin.get();
  84. }
  85.  
  86. //scissors
  87. if (choice == "Scissors" && computer == 3)
  88. {
  89. cout << "It's a tie!" << endl;
  90. cin.get();
  91. }
  92. else if (choice == "Scissors" && computer == 1)
  93. {
  94. cout << "You lose kek" << endl;
  95. cin.get();
  96. }
  97. else if (choice == "Scissors" && computer == 2)
  98. {
  99. cout << "You win" << endl;
  100. cin.get();
  101. }
  102. return 0;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement