-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRPSLizardSpock.cpp
More file actions
41 lines (33 loc) · 924 Bytes
/
RPSLizardSpock.cpp
File metadata and controls
41 lines (33 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
Rock Paper Scissors Lizard Spock
(The Big Bang Theory)
*/
#include <iostream>
#include <stdlib.h>
int main() {
srand (time(NULL));
int computer = rand() % 5 + 1; //random number between 1-3 inclusive
int user = 0;
// prompt user for input
std::cout << "====================\n";
std::cout << "Rock Paper Scissors!\n";
std::cout << "====================\n";
std::cout << "1) ✊\n";
std::cout << "2) ✋\n";
std::cout << "3) ✌️\n";
std::cout << "4) 🖖\n";
std::cout << "5) 🦎\n";
std::cout << "Shoot! ";
std::cin >> user;
std::cout << "Computer chose: " << computer << std::endl;
if (user == computer){
std::cout << "It's a Tie!!" << std::endl;
}
else if (computer == user + 1 || computer == user+3 || computer == user-2 || computer == user/5){
std::cout << "You Lose!" << std::endl;
}
else{
std::cout << "You Win!" << std::endl;
}
return 0;
}