Help

Status
Not open for further replies.

Quite_Angle

Beta member
Messages
4
Hi member,

I want you guys help in this....I’m New to programming and i was trying to practice to programme small game..which is “ guessing the number” here is the code I wrote
ItÂ’s working but I want to know how can I control the user to choose only 3 time and telling them that the Game over.

This is the code I wrote:

Dim found as Boolean
Dim result as integer
Dim number as integer

Number=int((10*Rnd)+1)
Found= true

Do while found
Console print “ Guess the Number”
Result=Consoleread
If result= Number then
Consoleprint “you Got it”

Found=false
Elseif result>number then
Consolprint “it’s Less than this”
Else
Consoleprint “it’s greater than this”
End if
Loop

Help me please


Thanks
 
Insert a variable that keeps track of how many times you've gone through the loop.

Declare it ouside the loop and set it equal to 0.
Then at the beginning of the loop, increment the variable by one.
Change the condition of your loop to "Do while varible < 4"
 
Dear bla,
thanks for replying but i still face some problem..so can you help me by writing the code for me..i was trying all the day..and i couldn't make it.

thanks again
Q_A
 
I'm not sure what language your using to program in. It looks kind-of VBish, but I'm not positive. I can code it for you in something like Java or C/C++, but not whatever you're using.
 
Status
Not open for further replies.
Back
Top Bottom