can u give me an example of a program like this?
write a program that allows the user to play the game called the secret number with the comp. the user will try to guess the secret number, a number known only by the comp. this secret number is an integer value and lies between 0 and 100. if the user input number is not the secret number, then the computer will return a refined range containing the secret number. given the refined range, the user will try to guess the number again. the secret number can be generated by using a random number generator. u may use the function rand()%101 to generate a random number between 0 and 100. the seed for this number generator is given as srand(((unsigned)time(NULL)).

That's a fun assignment. How much code have you done?

Your post describes each step perfectly. Computer generates a number, user makes a guess, computer tells what range the number it is in, and so on. If you're problem is writing the code, learn some c++ first.

Your post describes each step perfectly. Computer generates a number, user makes a guess, computer tells what range the number it is in, and so on. If you're problem is writing the code, learn some c++ first.

ur right,,i'm only a beginner.. maybe i dun understand the basics completely..y dun u give me some examples of programs like this.. i would like to learn from them

You're not going to learn anything by having me give you code. Find a good tutorial. Besides, i'm sure there's examples of this game all over the web anyway.

Here's some documentation on rand() and srand(), it should help you get started

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.