Connecting Tech Pros Worldwide Forums | Help | Site Map

How do I get started in making a guessing game?

Newbie
 
Join Date: Sep 2009
Posts: 8
#1: Sep 24 '09
In C++ I have to create a guessing game that has three loops and and I have to make a flowchart. Now mind you I am a beginner at all of this. Someone help!

Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,208
#2: Sep 24 '09

re: How do I get started in making a guessing game?


Guessing what?
Why 3 loops? What is each loop going to do?

Flowcharts are a fairly simply way of mapping out the operation of a simple program (such as this). Read This
Newbie
 
Join Date: Sep 2009
Posts: 8
#3: Sep 24 '09

re: How do I get started in making a guessing game?


Dealing wih numbers.
First loop: A for loop and should count up from 1 to 4.
Second loop: A while loop and should caount from 4 to 1.
Third loop: A do...while loop and should count up from 1 to 4 in increments of 2.

The second part deals with automating the guessing and high/low decision. No user input required.

I basically just need help on setting it up.
Familiar Sight
 
Join Date: Jan 2007
Posts: 193
#4: Sep 30 '09

re: How do I get started in making a guessing game?


I assume the flow chart simply explains how the game works.
If that is correct why dont you post your chart and also the code which supports it identifying where you are having problems.
A simple guessing game usually requires the the generation of random numbers based on a seed (integer).i.e. ask the user to enter a number between 10 and 20 and use this for the seed to generate the 4 random numbers between 1 and 10. This happens every cycle of the while loop referred to below. Now you have the numbers (say 1,5,3,8)
Now (within the while loop) ask the user to guess the four numbers with cin>>n; in a four loop.
Report the degree of success each cycle of the while loop.
Reply