How to write a game of JACK N POY or Scissors, Paper, Rock using TURBO C?
Question by Iggy: How to write a game of JACK N POY or Scissors, Paper, Rock using TURBO C?
The input of player 1 should be hidden before player 2 can input.
Outputs should be like this
If Paper wins over rock “Paper covers rock”
if Rock wins over scissors “Rock breaks scissors”
if scissors wins over paper “Scissors cuts paper”
if draw “Nobody wins”
PS. I need the simplest code as possible. Thanks.
Best answer:
Answer by Nick T
You need to study in class and actually attempt your own homework.
PSEUDO CODE
DEFINE FUNCTION GetInput( Input Text as string ) returns character
..declare result as character value ‘ ‘
..LOOP WHILE ( result is no R S or P )
….output (text) (Rock, Scissors, Paper)
….input result
..END LOOP
..return result
END FUNCTION
MAIN ENTRY POINT
..declare Player1 as character value ‘ ‘
..declare Player2 as character value ‘ ‘
..Player1 = GetInput(“Player 1″)
..CLEAR SCREEN
..Player2 = GetInput(“Player 2″)
..CLEAR SCREEN
..IF( ( Player1 is Paper ) AND (Player2 is Rock) ) THEN output Paper covers Rock, Player 1 wins!
..ELSE IF( ( Player1 is Rock) AND (Player2 is Scissors) ) THEN output Rock breaks scissors, Player 1 wins!
..ELSE IF( ( Player1 is Scissors) AND (Player2 is Paper) ) THEN output Scissors cuts paper, Player 1 wins!
..ELSE IF( ( Player2 is Paper ) AND (Player1 is Rock) ) THEN output Paper covers Rock, Player 2 wins!
..ELSE IF( ( Player2 is Rock) AND (Player1 is Scissors) ) THEN output Rock breaks scissors, Player 2 wins!
..ELSE IF( ( Player2 is Scissors) AND (Player1 is Paper) ) THEN output Scissors cuts paper, Player 2 wins!
..ELSE output Its a Draw!
END MAIN
Add your own answer in the comments!
Disclaimer
Top Posts
- CATIA V6 | Industrial Layout | CATIA Natural Sketch for 3D Sketching Encounter (4895)
- In-Spot Augmented Reality 3D Sketching of Mechanical Techniques (4851)
- Audi R8 V10 Speed Drawing with pencil - juho234 (4838)
- Chuck Jones shows how to draw Bugs Bunny (4792)
- Aikon2-Skediomata robotic technique drawing faces (4772)
News
- Church hosts fundraiser for veteran equine program - Baraboo News Republic May 23, 2013Church hosts fundraiser for veteran equine programBaraboo News Republic... a custom oil portrait of […]
- Arts review: Degree Show 2013, Duncan of Jordanstone College of Art & Design ... - Scotsman (blog) May 22, 2013Scotsman (blog)Arts review: Degree Show 2013, Duncan of Jordanstone College of Art & Design ...S […]
- Looking back on the highlights of Artweeks - The Oxford Times May 22, 2013Looking back on the highlights of ArtweeksThe Oxford TimesHowever, the pieces that really sing throu […]
- AFI Docs Announces Lineup - DCist.com May 22, 2013AFI Docs Announces LineupDCist.comIn addition to its longtime home at the AFI Silver Theatre, the fe […]
- Celebrity Paintings: Classical Masterpieces Remixed In Worth 1000 Design ... - Huffington Post May 22, 2013Celebrity Paintings: Classical Masterpieces Remixed In Worth 1000 Design ...Huffington PostClassic p […]
Articles
Tags
Recent Search Terms
- how to place a grid over an image
- how to draw eyes on fondant
- turntable drawing machine construction
- how to draw shoes from the front
- easy-oil-painting-techniques org
- drawing female body step by step
- How to draw a woman kissing a man
- Pedobear face keyboard code
- how to draw jennifer lawrence in pencil step by step
- do you have to outline your drawing for canvas paint




