Jump to content


Photo

help with c++ in my computer programming class


  • This topic is locked This topic is locked
4 replies to this topic

#1 saf

saf

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 13 January 2008 - 02:14 PM

i have to wirte a program that asks the user to think of a number between 1 to 100. then the computer trys to guess the number. the program should initial guess of 50. the program should ask the user if 50 is the number the user has in mind, or if it is too high or too low. if 50 isnt right guess based on if its too high or too low. the program should make another guess. my program should continue to guess until the correct number is reached. i asked my teacher not much of a help. plzz help me.

#2 saf

saf

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 13 January 2008 - 02:20 PM

hi, i would be really glad if you can tell me how to write this program. i have to write a program that calculates the number of quaters, dimes, nickels, and pennies necessary to generate the number of cents entered as input. like for an example 84 cents is entered for input, the program should say 3 quaters, 1 nickle, 4 pennies. which adds up to 84. pllz can someone help me with this.

#3 rc69

rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 13 January 2008 - 04:13 PM

Moved to proper section.

We are not here to do your homework. If your teacher won't help, then that should leave whatever book you're using in class.

My hint, you are looking for a "binary search."
:google:

#4 rc69

rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 13 January 2008 - 04:17 PM

We are not here to do your homework. If your teacher won't help, then that should leave whatever book you're using in class.

:google:

Same as a "roman numeral" formatter thingy (dunno what to properly call it).

Run a loop, possibly a while loop. And subtract off the highest possible number each time till you get to 0 (more work is needed of course, conditionals, etc... but that is what you basically have to do).

#5 l3lueMage

l3lueMage

    Wanna Be Moderator

  • Publishing Betazoids
  • PipPipPipPip
  • 4,602 posts
  • Gender:Male
  • Location:Singapore

Posted 14 January 2008 - 02:38 PM

another hint use the random function




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users