We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include<iostream> #include<cstdlib> #include<time.h> //logic of the program /*Scissors cuts Paper. Paper covers Rock. Rock crushes Lizard. Lizard poisons Spock. Spock smashes Scissors. Rock destroys Scissors. Scissors decapitate Lizard. Lizard eats Paper. Paper disproves Spock. Spock vaporizes Rock. (and as it always has) Rock crushes Scissors.*/ int main() { int ch; do{ std::cout<<"\n"<<"Would you like to continue to play?"<<"\n"; std::cout<<"Type the number corresponding to your choice"<<"\n"; std::cout<<"1. Yes"<<"\n"; std::cout<<"2. No"<<"\n"; std::cin>>ch; switch (ch) { case 1:{ int computer = rand()%5 + 1; int user = 0; srand(time(NULL)); std::cout << "====================================\n"; std::cout << "rock paper scissors lizard spock!\n"; std::cout << "====================================\n\n"; std::cout << "1) ✊-Rock\n"; std::cout << "2) ✋-Paper\n"; std::cout << "3) ✌️-Scissors\n"; std::cout << "4) 🦎-Lizard\n"; std::cout << "5) 🖖-Spock\n"; std::cout << "shoot! \n"; std::cin>>user; std::cout<<"Computer choice: "<<computer<<"\n"; //logic rock with everything if (computer==1&&user==2) { std::cout<<"User has won!!"<<"\n"; std::cout<<"Paper covers rock"<<"\n"; }else if(computer==2&&user==1){ std::cout<<"Computer has won!!"<<"\n"; std::cout<<"Paper covers rock"<<"\n"; }else if(computer==1&&user==3){ std::cout<<"Computer has won!!"<<"\n"; std::cout<<"Rock destroys scissors"<<"\n"; }else if(computer==3&&user==1){ std::cout<<"User has won!!"<<"\n"; std::cout<<"Rock destroys scissors"<<"\n"; }else if(computer==1&&user==4){ std::cout<<"Computer has won!!"<<"\n"; std::cout<<"Rock crushes lizard"<<"\n"; }else if(computer==4&&user==1){ std::cout<<"User has won!!"<<"\n"; std::cout<<"Rock crushes lizard"<<"\n"; }else if(computer==1&&user==5){ std::cout<<"User has won!!"<<"\n"; std::cout<<"Spock vaporizes rock"<<"\n"; }else if(computer==5&&user==1){ std::cout<<"Computer has won!!"<<"\n"; std::cout<<"Spock vaporizes rock"<<"\n"; } //logic paper with everything if (computer==2&&user==3) { std::cout<<"User has won!!"<<"\n"; std::cout<<"Scissors cuts paper"<<"\n"; }else if(computer==3&&user==2){ std::cout<<"Computer has won!!"<<"\n"; std::cout<<"Scissors cuts paper"<<"\n"; }else if(computer==2&&user==4){ std::cout<<"User has won!!"<<"\n"; std::cout<<"Lizard eats paper"<<"\n"; }else if(computer==4&&user==2){ std::cout<<"Computer has won!!"<<"\n"; std::cout<<"Lizard eats paper"<<"\n"; }else if(computer==2&&user==5){ std::cout<<"Computer has won!!"<<"\n"; std::cout<<"Paper disproves Spock"<<"\n"; }else if(computer==5&&user==2){ std::cout<<"User has won!!"<<"\n"; std::cout<<"Paper disproves Spock"<<"\n"; } //logic scissors with everything if (computer==3&&user==4) { std::cout<<"Computer has won!!"<<"\n"; std::cout<<"Scissors decapitate lizard"<<"\n"; }else if(computer==4&&user==3){ std::cout<<"User has won!!"<<"\n"; std::cout<<"Scissors decapitate lizard"<<"\n"; }else if(computer==3&&user==5){ std::cout<<"User has won!!"<<"\n"; std::cout<<"Spock smashes scissors"<<"\n"; }else if(computer==5&&user==3){ std::cout<<"Computer has won!!"<<"\n"; std::cout<<"Spock smashes scissors"<<"\n"; } //logic lizard with everything if (computer==4&&user==5) { std::cout<<"Computer has won!!"<<"\n"; std::cout<<"Lizard poisons Spock"<<"\n"; }else if(computer==5&&user==4){ std::cout<<"User has won!!"<<"\n"; std::cout<<"Lizard poisons Spock"<<"\n"; } //ties if (computer==1&&user==1) { std::cout<<"Oops it's a tie!!"<<"\n"; }else if(computer==2&&user==2){ std::cout<<"Oops it's a tie!!"<<"\n"; }else if(computer==3&&user==3){ std::cout<<"Oops it's a tie!!"<<"\n"; }else if(computer==4&&user==4){ std::cout<<"Oops it's a tie!!"<<"\n"; }else if(computer==5&&user==5){ std::cout<<"Oops it's a tie!!"<<"\n"; } break; } default: if (ch!=2) { std::cout<<"Choose an option from above"<<"\n"; } } }while(ch!=2); return 0; }
The text was updated successfully, but these errors were encountered:
Yes, this is promising, how about adding sleeper/delay sequences or methods for the countdown.
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: