From 0a38bca8043bac49f9f0b6e2fb5abf45a7c5425b Mon Sep 17 00:00:00 2001 From: AndreiHulk07 <101246108+AndreiHulk07@users.noreply.github.com> Date: Sun, 16 Mar 2025 21:51:08 +0200 Subject: [PATCH] Create RockPaperScissorsGame.cpp This is a fun game try it --- .../RockPaperScissorsGame.cpp | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RockPaperScissorsGame.cpp diff --git a/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RockPaperScissorsGame.cpp b/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RockPaperScissorsGame.cpp new file mode 100644 index 0000000..0a0f98e --- /dev/null +++ b/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RockPaperScissorsGame.cpp @@ -0,0 +1,57 @@ +/*This program will run a game named Rock, Paper, Scissors, Lizard, Spock. +Author: Andrei Hulk +*/ +#include +#include +using namespace std; + +int main() { + // Live long and prosper + srand (time(NULL)); + int computer = rand() % 3 + 1; + int userChoice = 0; + // The begining of the game + cout << "======================\n"; + cout << "Rock, Paper, Scissors!\n"; + cout << "======================\n"; + /* + rock > scissors + scissors > paper + paper > rock + */ + cout << "1) ✊\n"; + cout << "2) ✋\n"; + cout << "3) ✌️\n"; + // Choosing carachter + cout << "Choose your battle thing! \n"; + cin >> user; + if( user == 1 ) + cout << "You have a good thing:✊ ,but \n"; + if( user == 2 ) + cout << "You have a good thing:✋ ,but \n"; + if( user == 3 ) + cout << "You have a good thing:✌️ ,but \n"; + if( computer == 1 ) + cout << "Computer has a good thing either:✊ ,so:\n"; + if( computer == 2 ) + cout << "Computer has a good thing either:✋ ,so:\n"; + if( computer == 3 ) + cout << "Computer has a good thing either:✌️ ,so:\n"; + // The BATTLE + if( user == computer ) + cout << "Its an equal fair\n"; + if( user == 1 && computer == 2 ) + cout << "Computer`s paper just covered your poor rock :((\n"; + if( user == 1 && computer == 3 ) + cout << "Thats great! You are a scissor smasher :))\n"; + if( user == 2 && computer == 1 ) + cout << "You really covered the computer`s little rock :))\n"; + if( user == 2 && computer == 3 ) + cout << "Thats sad! You are papercutted :((\n"; + if( user == 3 && computer == 1 ) + cout << "Sorry! Your scissor is in pieces :((\n"; + if( user == 3 && computer == 2 ) + cout << "Wowww! You really cutted that paper :))\n"; + if( user > 3 ) + cout << "You can`t compete with nothing, its really unfair\n"; +}