Posts: 74
Threads: 15
Joined: Nov 2005
Quote:well, that doesn't help...
so sorry, your post came before mine
y name is Nobody, and nobody's perfect. So now I am perfect
98% of the teenage population smokes or has smoked pot. If you're one of the 2% who hasn't, copy and paste this in your signature.
Posts: 1,956
Threads: 65
Joined: Jun 2003
Quote:tannervp Wrote:well, that doesn't help...
so sorry, your post came before mine
I'm assuming you meant my (Moneo) post.
Did you read my other suggestions?
*****
Posts: 74
Threads: 15
Joined: Nov 2005
yep. One thing...
Code:
RANDOMIZE TIMER
INPUT "Pick a number:"; num$
getnum% = INT(RND * 20) + 1
IF num$ =
THAT's where I need help.
y name is Nobody, and nobody's perfect. So now I am perfect
98% of the teenage population smokes or has smoked pot. If you're one of the 2% who hasn't, copy and paste this in your signature.
Posts: 1,025
Threads: 44
Joined: May 2005
well you can either change num$ to simply num if your user is only going to be inputting numbers. Otherwise you can do the VAL command. VAL(num$) converts your string to a number. then you can do it like this
Code:
IF VAL(num$) = getnum% THEN
PRINT "YOU WIN"
ELSEIF num > getnum'.....etc
I'd finish the code, but it looks like you need the practice and it would do you no good if I wrote the program for you
Posts: 484
Threads: 14
Joined: Apr 2005
surely if you give someone 5 guesss from 1-20
they can always win by splitting in half till they get it.
10 lower
5 higher
7 higher
8 higher
9 bingo
EVEN MEN OF STEEL RUST.
Posts: 3,368
Threads: 195
Joined: Jan 2003
yes, that's right.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 1,956
Threads: 65
Joined: Jun 2003
The "splitting in half" technique is called a Binary Search. Some programmers may think of it, but most regular users wont.
*****
Posts: 488
Threads: 19
Joined: Sep 2005
binary, a wonderful thing, but anyway there are many tutorials on this, plus theres a program called Learn To Program Basic, from scholastic, i bought it in a bok order in grade 8 like 3 years ago and it had programs premade, one of them was a guessing game too, altough the basic files were different, the coding was BASICally the same, lol, no pun intended but it happened, anyway, the coding aint really that hard no offence, its all basic math really
Posts: 484
Threads: 14
Joined: Apr 2005
Quote:Some programmers may think of it, but most regular users wont.
i wouldnt count on it, we were taught that in the first year of secondary school(age 11-12)
EVEN MEN OF STEEL RUST.
Posts: 677
Threads: 57
Joined: Jan 2005
Isn't their a EXAMPLE that shows you how to do this on QbasicNews.Com
Also A Trick i use to make random numbers easier is
Code:
Declare FUNCTION int.rnd(base1 as long, base2 as long) as long
FUNCTION int.rnd(base1 as long, base2 as long) as long
Return int((rnd*base2)+base1)
END FUNCTION
Int.Rnd ((The lowest possible number),(the highest Possible number)
url=http://www.sloganizer.net/en/]
[/url]