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.
help with c++ in my computer programming class
Started by
saf
, Jan 13 2008 02:14 PM
4 replies to this topic
#1
Posted 13 January 2008 - 02:14 PM
#2
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
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."
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."
#4
Posted 13 January 2008 - 04:17 PM
Same as a "roman numeral" formatter thingy (dunno what to properly call it).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.
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
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