Also, in a program that I have to make for school, we have to use arrays. I know how to load data into arrays, bubble sort them, print them out and stuff, but I just don't want to make a program that is just like "Hey, this is an array. Type some numbers." Do you know have any creative or fun uses for arrays?
Disp "Text to Print"
From the looks of what your saying BASIC can't return a value, which answers why my program kept giving me errors on my calculator when I tried to return H. Haha.
myX(){int x = 5;return x}
NUM is the name of the array. The "DATA" you saw comes into play with the READ command up there. It says for X = 1 to 10 READ the data. It reads the first ten numbers in my DATA line, which happen to be 1-10
So, when X = 1, it loaded 1 into NUM(1), when X = 2, it loaded 2 into NUM(2), and so on, until the ten numbers from my DATA line were in my array....called NUM
I'm not sure I understand the other part of your question. By "when X = 5" do you mean the fifth time the loop "For x = 1 to 10?" Like:
I'll miss this class :p I get to take C++ next year though so yay.
IF GUESS = RN + 1 OR GUESS = RN + 2 OR GUESS = RN - 1 OR GUESS = RN - 2 THEN GOSUB RANDRIGHTIF GUESS < RN - 2 OR GUESS > RN + 2 THEN GOSUB RANDWRONGIF GUESS = RN THEN GOSUB RANDEXACTNEXT X
RANDRIGHT:PRINT ""PRINT ""SCORE = SCORE + WAGPRINT "YOUR GUESS: "; GUESSPRINT "THE RANDOM NUMBER IS: "; RNPRINT "YOU GAINED "; WAG; " POINTS "PRINT "YOUR SCORE: "; SCORESLEEP 4RETURN
RANDWRONG:PRINT ""PRINT ""SCORE = SCORE - WAGPRINT "YOUR GUESS: "; GUESSPRINT "THE RANDOM NUMBER IS: "; RNPRINT "YOU LOST "; WAG; " POINTS"PRINT "YOUR SCORE: "; SCORESLEEP 4RETURN
RANDEXACT:PRINT ""PRINT ""BONUS = WAG + 3SCORE = SCORE + BONUSPRINT "YOUR GUESS: "; GUESSPRINT "THE RANDOM NUMBER IS: "; RNPRINT "YOU GOT"; WAG; " POINTS, PLUS A 3 POINT BONUS!"PRINT "YOUR SCORE: "; SCORESLEEP 4RETURN
POINTTILT:PRINT "YOU TRIED TO WAGER MORE POINTS THAN YOU HAVE!!!"SLEEP 3RETURN
Sure you can program on it. It's how I do so well on test. ;). And it's not cheating, "it's making using of technology available to me."
Yea I pulled the cards out randomly. I'm not sure what basic arrays look like but here's what it looked like in javascript.
myArray[randomize(0,3)][randomize(0,12)]
EDIT: I think we have TI-83s Pluses at school! Can you code on those??
also, did you pull the cards out of the array randomly? how do you go about doing something like that?
(Edited by penguincube at 9:50 pm on Dec. 2, 2004)
(Edited by penguincube at 10:14 am on Dec. 3, 2004)
Props to you.
EDIT: The array's part. I made a blackjack game that pulled cards out of an array. You could do something like that but print something like "King" instead of a picture. That has a good amount of logic involved in it too.
(Edited by squirellplayingtag at 9:28 pm on Dec. 2, 2004)