Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code in c++ please it shoupd also produce similar output to the one below Programmaing Assignment #1. Rock, Paper, Scissers bur Thursday. Febeuary 21 a
code in c++
Programmaing Assignment \#1. Rock, Paper, Scissers bur Thursday. Febeuary 21 a d11.59pm [VIA CANVAS] Write a progeam that prempts the vier for "Flaye 1"1 te ispis in integer malue between 1 and 3 (where Inpaper, Zovissor, and 3ueck Thit inpot ihould te pasced into a string tenction caled ploger. apsil. and refuret a string valoe ledicuting the seiection of paper, soisen, or rock fan memibeed abowe). Neat, the tetumed string vilue, alone with a generated input trot the computer, ahodd be pessed into a veid futction ealed egs camporiand and determines whether the vier's inpot er the combeter's generated input is the winner or it boek inputs revill. in D te. Thin frogram should plyy this zame ben bonsecilive times and cal a function came winser_tolly_to fliled so append the wimer ieither farrad-awisis, comperen winsms or the arrey is traverses. While thil data is being stored in the arry, the peogam sho sit taly the number wist for Player 1 , computer, and TR, resectivily, and cutpot the maty wib the robit witas Erompler PLAVET 1 MAS TNE MOST WWS IN THE REN GAM?? SEREES THE COMPUTER NALS THE MOST WINS IN TIE FEN GGMer sravs. MEAOAITV of THE GAMrS ENDCO INA fie Cede far creading the camputer' bentraned ingut is prewided belew. This inpest of code cas be placed ints the nain tanction: atring norputer aniaction. arand (tLen(0)). int ooep_nelectien = rand O+I+H. if (compineleckish =1 ) 1 cboiee in "pujes", 1 else it tootp_-ielection wh alI chosen = "aelisos" 1 elan if (oope selectien =3y I. string eomputer_melection: arand (time (0)) . int comp_selection = rand (\} i31i if ( coep_lelection =1)1. choice in "paper"? 3 elee if (ceep_seleotion =2)C eboice = "nainsor i I bise if (comp-aelection an 3) H. chotce =1 roek" 1 computer_-eleotion: = eholee: For those who are net accustomed to the Paper, Scisor, Pock game, poper beots recks, scissor beats poper, and rock beats sicissor. Your output to the progam should resemble the folowing (sece nect page): Pititis 1 wist Edwards-Macbook:Progranning Assignment t1 edwarddillons ./mein. ol ROCK, PAPER, SCISSORS GAME (MATCH A1) Player 1: Enter your choice (1=paper, 2=scissors, 3=rock): 3 Player 1 entered rock as the choice. Conputer selected seissors as the choice. PLAYER 1 WINS ROCK, PAPER, SCISSORS GAME (MATCH 2) Player 1: Enter your choice (1epaper, 2 escissors, 3=rock): 2 Player 1 entered scissors as the choice. Computer selected rock as the choice. coMPUTER WINS ROCK, PAPER, SCISSORS GAME (MATCH 13 ) Player 1: Enter your choice (1=paper, 2escissors, 3erock): 1 Player 1 entered paper as the choice. Conputer selected paper as the choice. IT'S A TIE ROCK, PAPER, SCISSORS OAME (MATCH \#4) Player 1: Enter your choice (1epaper, 2escissors, 3 erock): 1 Player 1 entered paper as the choice. Cosputer selected paper as the choice. IT'S A TIE ROCK, PAPER, SCISSORS GAME (MATCH #5 ) Player 1 entered seissors as the choice. Computer solected seissors os the choice. IT'S A TIE Player 1i Enter your choice (1) indper, 2necissors, 3erock): 3 PLAYER 1 WIAS Player 1: Entor your choice (1epoper, 2oneissors, 3eroek): 3 pooputer selected paper as the choice. ponpureR vins Conputer selected paper as the choice. P LAYER 1 wriss AOCK, PAPER, SCISSORS CNAE (WITEH aD) Llayer it Enter your choice (1-paper, 2nseissore, 3orock): 2 Player 1 entered paper as the choice. computer selected seissors es the choice. AOCK, PAPER, SCISSOnS CAME (WATCH 99 ) layer it Enter your choice (1epaper, 2escissort, 3urock): 1 player 1 entered paper as the ohofice. Conputer selected seissors as the choice. coventER WTNS ROCK, PAPER, SCISSONS OAME (WATCH A10) Llayer is Enter your choice (1epaper, 2esclstort, 3nroek): 2 Llayer 1 entered seissors as the choice. conputer selected rock as the choice. sondureR wThs LAYER1-WINS:11. govertER-WFinsI11 [teit! [xe11) rati11. LAYER1-WINSIII gexcure -WINSIII PaYERA-YTNS 111 comouren-WiNSIII goventen-Wras!11 THE COUPUTER HAS THE MOST VINS IN THE TEN CUVE SEAIES please it shoupd also produce similar output to the one below
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started