uRoll) Then msg = "I won" Else msg = "It's a tie" End If Return msg End Function"> uRoll) Then msg = "I won" Else msg = "It's a tie" End If Return msg End Function">
Download presentation
Presentation is loading. Please wait.
Published byRosa McGee Modified over 6 years ago
1
Dice Game Pseudocode Module main() Declare String reply
5/14/2018 Dice Game Pseudocode Module main() Declare String reply Declare Integer userRoll, compRoll Display “Do you want to play: Y/N” Input reply While(reply= “Y”) userRoll = random(1,6) compRoll = random(1,6) Display "You got a ", userRoll, " I got a ", compRoll Display getMessage(userRoll, compRoll) Display “Do you want to play again: Y/N” EndWhile End Module
2
5/14/2018 Dice Game Pseudocode Function String getMessage(Integer uRoll, Integer cRoll) Declare String msg If (uRoll > cRoll) Then msg = "You won" Else If (cRoll > uRoll) Then msg = "I won" Else msg = "It's a tie" End If Return msg End Function
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.