Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Say we have a game application where we want to continue executing the same inst

ID: 667617 • Letter: S

Question

Say we have a game application where we want to continue executing the same instruction until one player decides to quite or one of the players quit or one of the players win. Which is the most appropriate loop for this application ? Why ? Say we have a game application where we want to continue executing the same instruction until one player decides to quite or one of the players quit or one of the players win. Which is the most appropriate loop for this application ? Why ? Say we have a game application where we want to continue executing the same instruction until one player decides to quite or one of the players quit or one of the players win. Which is the most appropriate loop for this application ? Why ?

Explanation / Answer

For this particular scenario, "do-while" would be appropriate.

The reason is , the condition says the loop should continue until one player decides to quit or one of the players quit

or one of the players win.It will satisfy only if the loop gets executed atleast once.

Since using "do-while", we can execute task once and then based on condition we can decided whether to continue or not.So, this would be the appropriate loop for this application.