Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rightpro

macrumors newbie
Original poster
Apr 23, 2011
1
0
hi .friend i need ur help
i dont know how to slove this program and i submitted this program to marrow
Write a letter guessing game. Computer thinks of a letter and you guess the letter. If your guess is too high or too low as compared to computer’s number, program must notify you.
Design a program using do-while loop and terminate the loop when computer letter and your guessed letter become same.

Try with following inputs:
B G Z Y T

plssss help me
 

Bill McEnaney

macrumors 6502
Apr 29, 2010
295
0
hi .friend i need ur help
i dont know how to slove this program and i submitted this program to marrow
Write a letter guessing game. Computer thinks of a letter and you guess the letter. If your guess is too high or too low as compared to computer’s number, program must notify you.
Design a program using do-while loop and terminate the loop when computer letter and your guessed letter become same.

Try with following inputs:
B G Z Y T

plssss help me
Hey, rightpro,

How about something like this pseudocode?

Choose a letter.
Ask the user to guess a letter.
Read the user's letter.
While the user's letter differs from the letter the computer picked, if the user's letter is comes alphabetically before the chosen letter, then tell the user to guess a higher one; otherwise, tell him to guess a lower one. After you say whether his letter is higher or lower than the chosen letter. ask for another guess and then read it. When the user's letter equals the picked number, print "You won."
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.