# High/Low Flowchart help

• 02-04-2012
onyxius
High/Low Flowchart help
Here are my directions: Design the flowchart for Exercise #14 (The High/Low game described in the Game Zone) at the end of chapter 5 in Programming Logic. This is to be written in Visio then exported from Visio to Word. You are to submit the Word document.

Ok, Hi everyone, I have been lurking these forums for a few weeks and decided to finally register as there are some great people here. Anyway, I am needing some guidance/help on my flowchart. As of right now to me (i'm new to programming) this flowchart looks to be correct, but I know there is always room for improvement.
Would this work or should I change it up?
Thanks Guys
Attachment 11430
• 02-04-2012
Elysia
You seem to have swapped Guess > number in the flowchart.
Additionally, you seem to be repeating the same thing twice. You can just loop it again, obviously.
• 02-04-2012
oogabooga
Quote:

I know there is always room for improvement.

I would get rid of both subroutines.

finishUp is only doing one thing, so it just complicates things to put it in a subroutine.

startMe (not a very good name) has the generation of the random number AND the input of the user's guess in it -- completely unrelated things. Get rid of the subroutine. Put the input of the guess in the inner loop, and leave the random number generation at the top of the outer loop, and then get rid of the repetition.

Also, your "Yes" and "No" branches on "guess > number" need to be switched (if guess > number then the GUESS is too low, not the number).
• 02-04-2012
onyxius
ok, I saw what you were talking about repeating and true about the finishup so i just put the output in. I swapped the yes and no for the guess. Does this look acceptable?

He just changed some things. Here is what he has. I now need to figure out how to do the last bullet point. How many guesses it took. I'm not sure how to add that in there.

• Program generates a random number for the user to guess. 10 pts.
• Program contains a loop to allow the user to guess multiple times. 20 pts
• After each guess the program will print a message that the guess is too high or too low. 10 pts
• Program prints the number of guesses it took to guess the correct answer. 10 pts
• 02-04-2012
onyxius
ok here is my attempt at adding the counter. I still feel like i'm maybe not doing the loop as good as i could be.
• 02-05-2012
Elysia
This is one way of doing it. It is not bad.
Just keep in mind thst you need to reset guesses if they want go replay. I suggest you separate initialize program from initialize game. Basically every time you run the game, you need to initialize the gsme. Every time you run the program, you need to initialize the program.
• 02-05-2012
onyxius
Quote:

Originally Posted by Elysia
This is one way of doing it. It is not bad.
Just keep in mind thst you need to reset guesses if they want go replay. I suggest you separate initialize program from initialize game. Basically every time you run the game, you need to initialize the gsme. Every time you run the program, you need to initialize the program.

Are you referring to houseKeeping(), detailLoop(), endofJob()? keep each section separate?
• 02-05-2012
Elysia
From Start to HouseKeeping().
• 02-05-2012
onyxius
Quote:

Originally Posted by Elysia
From Start to HouseKeeping().

Ok, so if i'm understanding it correctly, move the line/arrow from input answer = Y pointing to housekeeping and move it to pointing to above declarations. or move declarations to housekeeping right?
• 02-05-2012
Elysia
All I am saying is that you should consider what happens when the user is asked to play another game.
Since counter = 0 belongs to your declarations section, it will never execute when branching to HouseKeeping(). Thus, you have a bug.
That is why I am proposing that you separate what needs to be done once when the program starts and what needs to be done every time you re-start the game.
• 02-05-2012
onyxius
Thank you everyone so very much for the guidance/help :D