This is the code for my mathprogram (I didn't intend to release the code, but I am having problems Sad )

The part that needs work is not quite half way through the code.

Also, program math1 is just a subprogram that repeats until left, right, enter, 2ND, or clear is pressed.


Code:
:SetUpEditor∟MATH
:2→dim(∟MATH
:ClrHome
:AxesOff
:FnOff
:PlotsOff
:ZStandard
:Disp "Math Program","   v2.1","","Penguin Studios","","Main Programmer:"," Bryce Taylor
:Output(8,4,"(C) 6-17-2006
:Pause
:ClrHome
:DelVar θ
:2→dim(∟MATH
:1+∟MATH(1→∟MATH(1
:∟MATH(2→Z
:If not(Z
:1→Z
:While θ≠45
:¦ ClrHome
:¦ Disp "Math Program 2.1
:¦ Output(8,1,"[CLEAR] to Exit
:¦ If Z=1
:¦ Then
:¦ ¦ Output(2,2,"Prime Factor    Test Prime
:¦ ¦ Output(4,2,"Radical Simp
:¦ ¦ Output(5,2,"Euclid's
:¦ ¦ Output(6,2,"LCM
:¦ ¦ Output(7,2,"Geometric Mean
:¦ ¦ prgmMATH1
:¦ ¦ If (X=5 or X=6) and (θ=21 or θ=105
:¦ ¦ Then
:¦ ¦ ¦ ClrHome
:¦ ¦ ¦ Input "1st?",A
:¦ ¦ ¦ Input "2nd?",B
:¦ ¦ ¦ AB→D
:¦ ¦ ¦ Repeat A=B or not(fPart(A/B
:¦ ¦ ¦ ¦ If A<B
:¦ ¦ ¦ ¦ Then
:¦ ¦ ¦ ¦ ¦ A→C
:¦ ¦ ¦ ¦ ¦ B→A
:¦ ¦ ¦ ¦ ¦ C→B
:¦ ¦ ¦ ¦ End
:¦ ¦ ¦ ¦ A-BiPart(A/B→A
:¦ ¦ ¦ End
:¦ ¦ ¦ If not(fPart(A/B
:¦ ¦ ¦ B→A
:¦ ¦ ¦ ClrHome
:¦ ¦ ¦ If X=5
:¦ ¦ ¦ Then
:¦ ¦ ¦ ¦ Output(1,1,"GCD:
:¦ ¦ ¦ ¦ Else
:¦ ¦ ¦ ¦ D/A→A
:¦ ¦ ¦ ¦ Output(1,1,"LCM:
:¦ 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X=6 and (θ=21 or θ=105
:¦ ¦ Then
:¦ ¦ ¦ Input " Coordinates?",A
:¦ ¦ ¦ A+1→dim(∟X
:¦ ¦ ¦ A+1→dim(∟Y
:¦ ¦ ¦ For(I,1,A
:¦ ¦ ¦ ¦ Prompt X,Y
:¦ ¦ ¦ ¦ X→∟X(I
:¦ ¦ ¦ ¦ Y→∟Y(I
:¦ ¦ ¦ End
:¦ ¦ ¦ ∟X(1→∟X(A+1
:¦ ¦ ¦ ∟Y(1→∟Y(A+1
:¦ ¦ ¦ DelVar BFor(I,1,A
:¦ ¦ ¦ ¦ B+∟X(I)∟Y(I+1)-∟X(I+1)∟Y(I→B
:¦ ¦ ¦ End
:¦ ¦ ¦ Disp abs(B/2
:¦ ¦ ¦ Pause
:¦ ¦ End

Code:
:¦ ¦ If X=5 and (θ=21 or θ=105
:¦ ¦ Then
:¦ ¦ ¦ ClrHome
:¦ ¦ ¦ Input "HOUR?",H
:¦ ¦ ¦ Input "MINUTE?",M
:¦ ¦ ¦ 90-30H-M/2→θ
:¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ ZSquare
:¦ ¦ ¦ Degree
:¦ ¦ ¦ Circle(0,0,6
:¦ ¦ ¦ Line(0,0,3.5cos(θ),3.5sin(θ
:¦ ¦ ¦ 90-6M→θ
:¦ ¦ ¦ Line(0,0,5cos(θ),5sin(θ
:¦ ¦ ¦ Pt-On(0,0,2
:¦ ¦ ¦ Text(55,5,abs(30H-5.5M),"o
:¦ ¦ ¦ Pause
:¦ ¦ ¦ ZStandard
:¦ ¦ End
:¦ ¦ If X=3 and (θ=21 or θ=105
:¦ ¦ Then
:¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ Text(‾1,1,15,"Information
:¦ ¦ ¦ Line(‾10,7,10,7
:¦ ¦ ¦ Line(‾9,‾10,‾9,10
:¦ ¦ ¦ Line(9,‾10,9,10
:¦ ¦ ¦ Text(10,10,"USED  ",∟MATH(1),"  TIMES
:¦ ¦ ¦ getTime→L0.7em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¦ 1000→W
:¦ ¦ ¦ ¦ If Y≥W
:¦ ¦ ¦ ¦ Y+V→V
:¦ ¦ ¦ ¦ If Y<W
:¦ ¦ ¦ ¦ V-Y→V
:¦ ¦ ¦ End
:¦ ¦ ¦ Disp V
:¦ ¦ ¦ Pause
:¦ ¦ End
:¦ ¦ If X=2 and (θ=21 or θ=105
:¦ ¦ Then
:¦ ¦ ¦ ClrHome
:¦ ¦ ¦ Disp "√(2)-1 TO STOP
:¦ ¦ ¦ DelVar B
:¦ ¦ ¦ DelVar C
:¦ ¦ ¦ DelVar D
:¦ ¦ ¦ While B≠√(2)-1
:¦ ¦ ¦ ¦ Input "NUMBER?",B
:¦ ¦ ¦ ¦ B+C→C
:¦ ¦ ¦ ¦ 1+D→D
:¦ ¦ ¦ End
:¦ ¦ ¦ D-1→D
:¦ ¦ ¦ C-√(2)+1→C
:¦ ¦ ¦ ClrHome
:¦ ¦ ¦ If not(fPart(C/D
:¦ ¦ ¦ Then
:¦ ¦ ¦ ¦ Output(1,1,C/D
:¦ ¦ ¦ ¦ Else
:¦ ¦ ¦ ¦ Input "PLACES?",A
:¦ ¦ ¦ ¦ round(C/D,A→B
:¦ ¦ ¦ ¦ ClrHome
:¦ ¦ ¦ ¦ Output(1,1,B
:¦ ¦ ¦ End
:¦ ¦ ¦ Pause
:¦ ¦ End
:¦ End
:¦ Z+(θ=26 and Z<2)-(θ=24 and Z>1→Z
:End
:ClrHome
:Disp "Thanks for","using!
:Z→∟MATH(2
:AxesOn
:FnOn
:ClrDraw
:DelVar ADelVar BDelVar CDelVar DDelVar EDelVar FDelVar GDelVar HDelVar IDelVar JDelVar KDelVar LDelVar MDelVar NDelVar ODelVar PDelVar QDelVar RDelVar SDelVar TDelVar UDelVar VDelVar WDelVar XDelVar YDelVar ZDelVar θDelVar Str1DelVar Str2Archive∟MATH


I know this is long, but I can't find where it is messing up. If I take out the part inside the **s, then the program runs correctly and allows me to move between pages. However, when that part is put in, it does not run correctly and generates ERR:SYNTAX at the last end statement. I am having a similar problem with one of my games (the loading screen).

I hope someone knows what is wrong, because I sure don't.
would you mind highlighting the offending code?
Oh, I forgot that *s aren't very noticeable in long code.

The blue part is the offended part. If it is removed, it works fine. If not, it doesn't.

If you want a copy of the actual program, give me your email address and I will send it to you.

Mine is soccerboy1992@gmail.com

This is really wierd...
you have an extra End in there somewhere Wink
Not according to me, or the source coder Wink

I only have 28...

Like I said, I have the same error in another program, where the program is a lot smaller and I actually went through and counted all of the End statements.

Where is the extra End you are seeing?

Oh, and I got on your forum Very Happy
Send me the program, FLCLlove4@lycos.com. I may now what's wrong but I want to test it for myself.
I emailed you the file and pgrmMATH1.

What is really wierd is that I didn't have that the code works fine without the blue part, but once the blue part is added, it messes up.

Lol, I just realized that I sent it to the wrong address Very Happy

Also, anyone can use any of my routines in the source code now that I have released it, but please give credit to Penguin Studios. Thanks.

Oh, I think I can find the link to our wonderful website!

BTW, the guy in charge hasn't told me how to edit it yet Sad

http://www.urzun.com/ps/
try maybe having that delvar on one line, and then the next command on the next line and see what happens.
rivereye wrote:
try maybe having that delvar on one line, and then the next command on the next line and see what happens.


that would do it too.
Right. NEVER put a loop command on the same line as a Delvar.
That's what I'm thinking. BTW you can put a Delvar next to most Repeat commands, but it's safer not to try it.
IT's a TI-OS bug: loops + DelVar makes the loop malfunction. And SC would have told you in you had a loop mismatch (missing End).
I'm 90% sure this is the problem, especially since you have a similar situation but the Delvar and For loop are on seperate lines and works fine.
For the sake of readability, I jammed that code into code tags, but I kept the offending section clear.
W00T!! That did the trick!!

Thanks a lot, I almost always have DelVars before loops, but now I know.

Also, it is kind of strange, but you can try it for yourself, using the "offended" code in a while loop - there aren't any errors, which was what got me.

The change also worked in my other program, so yay!

Any other little things similar to that I should know (besides obvious things like putting DelVarEnd)?
Nope, nothing particular like that.
Doing "0 [sto>] <a-z,theta>" is faster than doing "DelVar <a-z,theta>" when you plan on using that variable, so it would be a good idea to not use the DelVar at all (except for cleanup before exiting, of course Laughing )
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement