Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 01-30-2006, 02:04 AM   #1 (permalink)
 
Newb Techie

Join Date: Nov 2005

Posts: 4

Quite_Angle

Default Help

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
Quite_Angle is offline  
Old 01-30-2006, 08:28 PM   #2 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default

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"
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 02-02-2006, 02:24 AM   #3 (permalink)
 
Newb Techie

Join Date: Nov 2005

Posts: 4

Quite_Angle

Default

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
Quite_Angle is offline  
Old 02-07-2006, 06:34 PM   #4 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default

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.
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On