CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 125 users online: 5 members, 80 guests and 40 bots.
Members: ACagliano, tifreak8x, xologist.
Bots: VoilaBot (3), Spinn3r (2), MSN/Bing (1), Magpie Crawler (3), VoilaBot (11), Googlebot (19), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
Author Message
ThankYouGod


Newbie


Joined: 17 Nov 2011
Posts: 11

Posted: 21 Nov 2011 05:20:24 pm    Post subject: S'more TI-BASIC Help

Okay, so I want to make a program that calculates area based on dimensions given. However, there is no 1 universal formula for area, so I wanted to make a menu.


Code:

:MENU("SELECT A SHAPE","SQUARE",1,"TRIANGLE",2,"CIRCLE",3,"ETC...
:If 1, Then
:INPUT "LENGTH "→L
:INPUT "HEIGHT"→H
:INPUT "IF 3D, WIDTH"→W
:LWH

...and so on?
Back to top
Kaslai


Member


Joined: 16 Nov 2011
Posts: 172
Location: ???, WA

Posted: 21 Nov 2011 05:22:59 pm    Post subject:

The menu syntax is Menu(Title,Option1,Label1,...
So the program should look like this:


Code:
:MENU("SELECT A SHAPE","SQUARE",LA,"TRIANGLE",LB,"CIRCLE",LC,"ETC... 
:Lbl LA
:...
:Lbl LB
:...

_________________



Back to top
Weregoose


Cemetech Expert


Joined: 23 Oct 2009
Posts: 463

Posted: 21 Nov 2011 05:23:27 pm    Post subject:

The numbers in the Menu( command should associate with labels in your code.

Code:
:Lbl 0
:MENU("SELECT A SHAPE","SQUARE",1,"TRIANGLE",2,"CIRCLE",3
:Lbl 1
:INPUT "LENGTH "→L
:INPUT "HEIGHT"→H
:INPUT "IF 3D, WIDTH"→W
:Pause LWH
:Goto 0
:Lbl 2
...

_________________
Common Errors in English · How To Ask Questions The Smart Way
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55763
Location: Earth, Sol, Milky Way

Posted: 21 Nov 2011 08:59:56 pm    Post subject:

While we're picking on problems, That's not the proper syntax for Input. It's actually:


Code:
Input "STRING TO DISP",VAR

Input "LENGTH=",L

_________________


Back to top
ThankYouGod


Newbie


Joined: 17 Nov 2011
Posts: 11

Posted: 21 Nov 2011 09:16:52 pm    Post subject:

I finally realized about the wrong Syntax after about 4 errors.

I finally got the code:


Code:
PROGRAM:RegularPolygon
:INPUT "NUMBER OF SIDES=",N
:INPUT "LENGTH OF ANY ONE SIDE=",S
:DISP "AREA=",(S²N)/(4tan(π/N))


It works, but only for regular polygons.

I started a menu for different shapes that can't be solved with this, but it eventually threw me syntax errors.


Code:
PROGRAM:SHAPES
:Lbl 0
:MENU( "TRIANGLE",1,"SQUARE",2,"RECTANGLE",3,"CIRCLE(RADIUS)",4,"CIRLCE(DIAMETER),5, //I STOPPED THERE.
:Lbl 1
:INPUT "BASE=",A
:INPUT "HEIGHT=",B // I WANTED TO KEEP IT SIMPLE, NO NEED TO FIND FOR HEIGHT.
:DISP "AREA=",.5BH
:PAUSE
:Lbl 2
:INPUT "LENGTH=",A
:DISP "AREA=",A²
:PAUSE
:Lbl 3
:INPUT "LENGTH=",A
:INPUT "HEIGHT=",B
:DISP "AREA=",AB
:PAUSE
:Lbl 4
:INPUT "RADIUS=",R
:DISP "AREA=", πR²
:PAUSE
:Lbl 5
:INPUT "DIAMETER=",D
:DISP "AREA=",(π/4)*(D²)
:PAUSE


Last edited by ThankYouGod on 21 Nov 2011 09:24:00 pm; edited 2 times in total
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55763
Location: Earth, Sol, Milky Way

Posted: 21 Nov 2011 09:19:12 pm    Post subject:

I'm assuming you're still using TI-BASIC; that uses "Lbl 1" etc instead of "L1". Sidebar: You know that SourceCoder can automagically grab text-formatted source code from your .8xp files, right? I just get a tad thrown by your TI-BASIC that appears to be formatted somewhat like QBASIC other than the missing line numbers.
_________________


Back to top
ThankYouGod


Newbie


Joined: 17 Nov 2011
Posts: 11

Posted: 21 Nov 2011 09:21:07 pm    Post subject:

I am still using TI-BASIC, and wow, that's quite possible.

I am aware of the fetching features of the fantastic tool, SourceCoder, however, I prefer to work on Notepad first, then plug or make the .8xp.

Thanks.
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2958

Posted: 21 Nov 2011 09:24:06 pm    Post subject:

Sidenode: QBasic doesn't have line numbers Smile To add on to what Kerm said, if you use SourceCoder, it will be much easier to read than this shouting code you pasted. TI-Basic has tokens like Input (Note the casing) not INPUT. And, as Kerm said, too (Razz), TI-Basic uses Lbl (I can't think of any language that uses L only). You might be using lists just because the tokens looked close enough, but L1-L6 [2nd][1] through [2nd][6] aren't labels, they stand for List1 List2 List3, etc.
_________________
http://tanner.myserverathome.com
Back to top
souvik1997


Guru-in-Training


Joined: 19 Apr 2010
Posts: 2870

Posted: 21 Nov 2011 09:24:32 pm    Post subject:

If you're just starting out with TI-Basic, I highly recommend that you do most of your coding on your calculator using its editor; it will help you test things faster and you can better understand what the commands do.
_________________
CALCnet Tournament-38%


deviantArt
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55763
Location: Earth, Sol, Milky Way

Posted: 21 Nov 2011 09:26:01 pm    Post subject:

souvik1997 wrote:
If you're just starting out with TI-Basic, I highly recommend that you do most of your coding on your calculator using its editor; it will help you test things faster and you can better understand what the commands do.
Heartily seconded. One of the best strengths of TI-BASIC is that since it's written on its target device and requires no compilation, the time between typing a line of code and testing it is nearly instantaneous, which provides for nice tight, fast debug/fix/debug/fix cycles. Smile
_________________


Back to top
ThankYouGod


Newbie


Joined: 17 Nov 2011
Posts: 11

Posted: 21 Nov 2011 09:26:10 pm    Post subject:

I think that's also what I did, _player.

souvik, I guess I should get in that habit. It's quite tedious, though.
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2958

Posted: 21 Nov 2011 09:27:44 pm    Post subject:

Much less tedious than typing out every single command, plugging it into a converter, opening TI-(Dis)Connect, sending the program, and running it, surely? Compared, of course, to: open the TI-Basic editor, write code, run, repeat.
_________________
http://tanner.myserverathome.com
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55763
Location: Earth, Sol, Milky Way

Posted: 23 Nov 2011 09:41:20 am    Post subject:

_player1537 wrote:
Much less tedious than typing out every single command, plugging it into a converter, opening TI-(Dis)Connect, sending the program, and running it, surely? Compared, of course, to: open the TI-Basic editor, write code, run, repeat.
I certainly agree with you there, Catherine. Smile And of course the occasional TI-Connect -> SourceCoder -> Cemetech post when you get stuck with something. Smile
_________________


Back to top
Rascherite


New Member


Joined: 09 Nov 2011
Posts: 93
Location: Under a heaping pile of saxophones

Posted: 23 Nov 2011 12:43:48 pm    Post subject:

ThankYouGod wrote:
souvik, I guess I should get in that habit. It's quite tedious, though.


Souvik is 100% right. It's much better to do it on calc (as the 2 or 3 users before me said...)

Protip: Getting to know the shortcut numbers and letters for all the menus in your calc makes it WAY faster to program (and do other random tasks). It's kinda tedious to remember at first, but you'll get used to it Smile

for instance, when writing a basic program and you want to put a Lbl in, the keystrokes
[prgm] [9] [enter]

make the task WAY faster than
[prgm] [down] [down] [down] [down] [down] [down] [down] [down] [enter]

Just to make sure, when you try to write a BASIC program with the on-calc editor, you aren't typing the commands letter by letter, are you? (That's what I did when I first started programming my calc.... It made it preeeettty difficult to run my programs Laughing )
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55763
Location: Earth, Sol, Milky Way

Posted: 23 Nov 2011 01:11:38 pm    Post subject:

Hehe, that's always key, but I think he got that lesson by now. Wink At one point I was ridiculously skilled at both touch-typing strings and touch-typing commands without actually looking at what menus I was going into, but I'm afraid school and work have wrested that skill from my brain. Sad
_________________


Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 
Jump to:  
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

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.035667 seconds.