Play the rock paper scissors game
Play the rock paper scissors game. Two players enter either "rock", "paper" or "scissors" and the winner is determined as follows: paper covers rock, rock breaks scissors, scissors cut paper. Ask the user if s/he wants to play again. BE SURE to include a function called play, called in main as follows:
answer = play(choice1, choice2);
cout << answer << endl;
Here is an example output:
Play rock, paper, scissors
Player 1: rock
Player 2: paper
Player 2 wins -- Paper covers rock
Do you want to continue? (yes or no): yes
Player 1: paper
Player 2: scissors
Player 2 wins -- Scissors cut paper
Do you want to continue? (yes or no): yes
Player 1: rock
Player 2: rock
Draw!
Do you want to continue? (yes or no): no
Thanks for playing!
Answers
Status NEW
Posted 16 Jul 2017 03:07 AM
My Price 1.00
Pla-----------y t-----------he -----------roc-----------k p-----------ape-----------r s-----------cis-----------sor-----------s g-----------ame-----------
Attachments
file 1500174469-Play the rock paper scissors game.docx preview (341 words )
P-----------lay----------- th-----------e r-----------ock----------- pa-----------per----------- sc-----------iss-----------ors----------- ga-----------me.----------- Tw-----------o p-----------lay-----------ers----------- en-----------ter----------- ei-----------the-----------r &-----------quo-----------t;r-----------ock-----------&qu-----------ot;-----------, &-----------quo-----------t;p-----------ape-----------r&q-----------uot-----------; o-----------r &-----------quo-----------t;s-----------cis-----------sor-----------s&q-----------uot-----------; a-----------nd -----------the----------- wi-----------nne-----------r i-----------s d-----------ete-----------rmi-----------ned----------- as----------- fo-----------llo-----------ws:----------- pa-----------per----------- co-----------ver-----------s r-----------ock-----------, r-----------ock----------- br-----------eak-----------s s-----------cis-----------sor-----------s, -----------sci-----------sso-----------rs -----------cut----------- pa-----------per-----------. A-----------sk -----------the----------- us-----------er -----------if -----------s/h-----------e w-----------ant-----------s t-----------o p-----------lay----------- ag-----------ain-----------. B-----------E S-----------URE----------- to----------- in-----------clu-----------de -----------a f-----------unc-----------tio-----------n c-----------all-----------ed -----------pla-----------y, -----------cal-----------led----------- in----------- ma-----------in -----------as -----------fol-----------low-----------s: ----------- an-----------swe-----------r =----------- pl-----------ay(-----------cho-----------ice-----------1, -----------cho-----------ice-----------2);----------- c-----------out----------- &a-----------mp;-----------lt;-----------&am-----------p;l-----------t; -----------ans-----------wer----------- &a-----------mp;-----------lt;-----------&am-----------p;l-----------t; -----------end-----------l; ----------- He-----------re -----------is
Not Rated(0)