I created a random number game where the user tries to guess the number using a while statement with three ifs in it for high low and correct number. but after the user guesses the the number it ends the while and the program. How can I make it so the user can guess another number it he or she would like? I was thinking of making the while statement a function and calling it with main. Any guidence would be appreciated.
Thanks,
Rich
RichC
0
Newbie Poster
Recommended Answers
Jump to PostShow us what you have so far, it's much easier that way to help you!
Jump to PostHI,
This is a very inefficent :rolleyes: example, however it might give you an idea on how to implement your loop so that it ask for a number again.SAMPLE OUTPUT:
NOTE:It was run on a linux machine.smg@samoguz-desktop ~/Desktop
$ ./numguess the number:
2
Guess …
Jump to Postplease edit your post and insert code tags so that my eyes will not hurt so bad when I read your code.:eek: :eek:
My bad. Let me know if you can read it now. :!:
#include <iostream> using namespace std; int main() { int number=10; int x; …
All 11 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
RichC
0
Newbie Poster
JoBe
36
Posting Pro in Training
samoguz
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
samoguz
0
Newbie Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
samoguz
0
Newbie Poster
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
RichC
0
Newbie Poster
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.