Rock Paper Scissors
"Coding is today's language of creativity" - Marie Clawe
Rock Paper Scissors
I recreated the classic, simple game using C++!
Instructions
Copy the code from the end of this page
Paste it into the compiler.
Hit the Run button
Play!
Demos
Code
#include <iostream>
#include <stdlib.h>
int main() {
srand(time(NULL));
int computer = rand() % 3 + 1;
int user = 0;
std::cout << "😁 ROCK PAPER SCISSORS 😁\n\nChoose: \n 1) Rock\n 2) Paper\n 3) Scissors\nAnswer: \n";
std::cin >> user;
std::cout << "Rock...\nPaper...\nScissors...\nShoot!\n";
if ((computer == 1 && user == 2) ||
(computer == 3 && user == 1) ||
(computer == 2 && user == 3))
{
std::cout << "🎉 You win! 🎉\n";
}
else if ((computer == 1 && user == 1) ||
(computer == 2 && user == 2) ||
(computer == 3 && user == 3))
{
std::cout << "🎀 It's a tie! 🎀\n";
}
else {
std::cout << "😭 You lose! 😭\n";
}
}