Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help creating a C program based on this flowchart I have created for the game of mastermind rint: Welcome to the game of

I need help creating a C program based on this flowchart I have created for the game of mastermind

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribed

rint: Welcome to the game of mastermind! Print: "I will select a random /4-digit number using digits 1 to 9 and you till attempt to guess my number. InYou only have 10 rounds so use your choices wisely. In to help you identify this number, I will tell you how many of your digits Cur in exactly the Insame position as in my number, and how many digits occur in my number but in a different position Press I if you would like to play nor press any number to exit ") Numbers ["1", 2, 3, 4, 5","6", -",","9") computer Numberl picks random number from Numbers computerNumber2- picks random number from Numbers computerumber picks random number from computer Number picks random number from Numbers Loop (repeat 10 times) Loop (repeat 10 times) guess Numberl - INPUT ("Enter First Number" guess Number 2 - INPUT ("Enter Second Number") quess Number 3 - INPUT ("Enter Third Number") guess Number4 - INPUT ("Enter Fourth Number") Correct Location indumber Correct Numberkongsber guess Numberl> computer Nutti dess Number computer Number Correct LocationAndilbert-1 guess Number - computer Number3 esa Numberi CouterNuiters Adessumberl computerNumber2 OR Correct LocationAndilbert-1 guess imberl - computer Number 3 pessNumberly CouterNuters True Correct Number rongLocational guessNumber ce puterNam2 Number2 computer Number OR Correct LocationAndilumbert-1 guess Number2 computer Number Ness Number2 computerungen True Correct NumberWrong Location False guess Number 3-> computer Numb3 fuess Numbers computer Number Correct locationAnNumber1 quesauber computer Number2 False Correct LocationAndalumber gues Number) - computer Number2 Ness Numbers computer Number True Correct Numberkonglocation False Guessumber computer by True Adessumber computerkumber Correct LocationAnNumber guess Number - computer Number2 OR Ness Number computeriner True Correct Number ong Locational ou have + Correct LocationAnd lumber + "digits in the correct location and Correct.Numberkonglocation digits in the wrong location Orrect Location And > OUTPUT Rou have" + correct Location And lumber + "digits in the correct location and Correct. Number trong Location - digits in the wrong location Correct LocationAndme> EXIT LOOP Correct LocationAndium OUTPUT "Congratulations, you win OUTPUT "Sorry, you lost

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions