0

The game will have the computer generate a secret random number in the range of 1 to 100. The user will then have six tries to guess the secret number. After each guess, the algorithm will tell the user if the guess was too high, too low or was correct.
If the user correctly guesses the secret number within six guesses, then the user has won the game. The game will stop looping when the secret number has been correctly guessed. If the user does not guess the secret number within six guesses, then the user has lost the game. Display an appropriate message to the user at the end of the game.

so far i have this. I don't know what to do after this.help me please.

Attachments flowchart.jpg 24.36 KB
5
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by JudeV
1

The game will have the computer generate a secret random number in the range of 1 to 100. The user will then have six tries to guess the secret number. After each guess, the algorithm will tell the user if the guess was too high, too low or was correct. If the user correctly guesses the secret number within six guesses, then the user has won the game. The game will stop looping when the secret number has been correctly guessed. If the user does not guess the secret number within six guesses, then the user has lost the game. Display an appropriate message to the user at the end of the game.

so far i have this. I don't know what to do after this.help me please.

I don't this is right or not. I think this can give u an idea.Actually when at Condition you need to think Yes or Not only.

Attachments answer.JPG 112.74 KB
0

You should just use a while loop with a counter, and a break statement... Here's an example:

class Game
{
    public void Main()
    {
        int counter = 0;
        bool win = false;
        int number = 10;    //Set number...

        while (counter<=6)
        {
            input = 0;      //Input set to input...
            if (input == number)
            {
                win = true; //Victory!
                break;      //Exit loop...
            }
            //Otherwise, keep looping...
        }
        if (win)
        {
            //Player won....
        }
        else
        {
            //Player lost...
        }
    }
}

Hope I helped!

EDIT: Wait, were you looking for a correct flowchart, or code based on the flowchart you gave us? I just reread the question, and I'm not sure if I answered what you were asking.

Edited by EternityCoder: n/a

0

i know to write it in a code...i just don't know how to do it correctly in the flowchart...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.