Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write Code in C Tried to do it myself, but getting stuck. You can either re-write my code or do the code yourself. You dont
Write Code in C
Program Specifications Write a program to calculate the score trom a thtow of five dice Scores are assigned to different categories for singles, three of a kind, four of a kind. five of a kand, ful house, and stuaght Follow each step to gradually complete al functions Note This program is designed forincremental development Complete each step and subonit for grading before starting the next step Only a portion of tests pass atter each step but conitin progress Step 0. Review the provided maino function Five integer values are input and inserted into an array The input values are in ascending order The array is passed to Findtightscored to deternine the highest sconing category Make no changes to main() Stubs are srovised tor all remaining functions Step 1 (3 pts). Complede the CheckSingles0 function. Return the sum of all values that match parameter goar update the FindlighSeorri) function using a loop to call Checksingles() six times with parameters being 1 - 6 . Fetum the highest score from all function talis submt for grading to consirm two tests pass Ex if input is 1.24:4.5 The output High teore: 8 ascending order, tame values are stored in porisecutive index locations Return 30 from Chech Three2kindo if the dice contain atieast three of the same valueb Ex (2,3,3,3,6) Retum 40 from CheckFourotkind it the of co contain at leadit four of the sama valueu, Ex (4. 4. call that three functions and retum the highagt score from all function cass. Submit tor grading to confi Ex it input is in ts cosis. 2020 LAE*: Program Pilour dice game. Ninclude icstalo.h] Whecluat sstrine. uinclude irtelle. Z Alda acc iccurences of geat nator int onecisineler(tnt dicefle int ceal) Int score - et If (alcell] goul scare on gabl! return score: U/ oneck for three of o ritid (rece =39) Int cbeck Threeorivind(tint dicell 1st lastvolue 11 1int count - i for(int 1 - ef 1 eHtest (dice[streof(atce) isitenf(atcefo])] , 1*t) If (dicelt] Intwalue) count+o else count if if alice lastia if (cosent on 3) return is: return ot If onch for four of a kind (scere - 4a) Int chechfourofikind (litit afce[1] int last value 1 in if(atre [1] A laitvalue) coont n+1 else count - 1 lastvalue a atcetil: return of If oneck for ffus of okind racirs = sie? int cleckflieonctadeint dicell Develop mode Submit mode. irout ra sas in the Iritbos, when elick Run program and ff Int checifiemoretndidit atcelf) ( Ch obeck-fer futt howe (acters - 2B ) itit chest fallubute(tit atcelli) (. Int Inst valat - it Int coant =0 in int. pair Couniti = ei. catint =17 Lastvalue - iftee 11 is ifi(coint a 2 in petrceuntaf Itipalrcount m2)1 ferarm ret arm ef int Chacistralenitine oulate beel stralot = trict strafiet - Aelice! tareak.i 6.28 LAB* Program Poker dice game Al chech for stroight (score - 45) 95 Int checkstraight (Int values [i]) ( Int score = CheckThreeofkind(values); If (score > highscore) f highscore - score: score - checkfourofkind (vslues); If (score? highscore) f highscore - score; f iscore - Checkfiveofkind(values): if (score > highscore) i. highscore - score: score = CheckfullHouse (values); If(score. highscore) highiscore - score: score - checkstralght (values); If (score) highiscore) f. htghscare - score: j return highscore; home > 628 LAB* prugain Poluredice oame retern highsecre; Int maln(rald)1 Int diceValues If I: fanttat 1 in 1(5+++1) scabfiche gatervaleses (1)]2 (1) Find high itare on d avitget. ret urh 91 Develop mode st sulumit made Entor prognaes ingejt (opt) nadi) Tried to do it myself, but getting stuck. You can either re-write my code or do the code yourself. You dont need to explain why I just need to know what is correct. Thank you.
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