Hi, I'm Ben and I'm pretty new at programming but I decided to make a math program to help me in school. It's called "HLP" for help and it has about four functions: Pythagorean Theorem (it solves for leg and hypotenuse), Quadratic equation (it error checks to make sure there's a real answer), lowest common multiple and greatest common factor for two numbers (useful for working with fractions) discriminant for if you want to quickly figure out the number of answers your quadratic equation will have.

I'm always adding things when I come up with them but if anyone has any cool ideas I'd love to hear them.

Also does anyone know an easy get-around for the "Lbl and Goto" system in TI Basic, it's pretty bad. Forgive me if my code is redundant or stupid, you can probably tell that I'm self taught.

LINK→ https://pastebin.com/GQ81CNWV

-Ben
For a beginning project, this is really good! (My first ~100 were like REALLY impractical...)

As for redundancy and stupidity, oh god that code is good (by my standards).
Perhaps add factoring of numbers/polynomials, it's a good programming excercise, I think.

I know this is somewhat of a bad habit I have, but if organization is a problem, perhaps split it up into different programs, then using the "rcl" button ([2nd][sto->]) to recall the programs, exactly in the places that you called them in the first place. (if that makes sense)

I'm afraid that Lbl and Goto is one of the best ways of hopping around a BASIC program, without going into complicated ways that make zero sense to me.

Hope this helps!
Thanks _iPhoenix_!

I thought about making multiple programs, but if I use the "rcl" function will it hide the extra programs from my list? I hate having a long list of programs on my calculator. If I lock them with this button http://imgur.com/a/hrkx3 will they not show up?

Thanks again,

-Ben

_iPhoenix_ wrote:
For a beginning project, this is really good! (My first ~100 were like REALLY impractical...)

As for redundancy and stupidity, oh god that code is good (by my standards).
Perhaps add factoring of numbers/polynomials, it's a good programming excercise, I think.

I know this is somewhat of a bad habit I have, but if organization is a problem, perhaps split it up into different programs, then using the "rcl" button ([2nd][sto->]) to recall the programs, exactly in the places that you called them in the first place. (if that makes sense)

I'm afraid that Lbl and Goto is one of the best ways of hopping around a BASIC program, without going into complicated ways that make zero sense to me.

Hope this helps!
Hello there, welcome to Cemetech! This seems like a well done program, especially for a beginner! There are a couple of programming practices I would like to clarify some things on, though.
    ▪ For starters, there are shortcuts you can take when displaying text. For example, instead of doing Disp "TEXT":Input A, you could do Input "TEXT",A to display a message alongside a variable input (limited to 16 characters; you can do more, but it'll be cut off).
    ▪ Also, instead of Disp "TEXT":Pause, you can do Pause "TEXT", but that comes with some different features. There is an added benefit that this allows the user to scroll through whatever text or variable you're displaying, but there is an added caveat (or maybe not, depending) that whatever follows the Pause command gets stored to Ans (Ans is just the last result you had).
    ▪ A lot of times (not all the time), some grouping symbols are unnecessary. Most of the time, closing parentheses and quotes can be left off, and the newline and store arrow are enough to "close" the parentheses. (The colon also goes to a new line, except for when it's in quotes, in which case it will be treated as a character.) This saves some bytes of code, which saves space for more code, and often makes your program run slightly faster.
    ▪ It's usually good practice to, instead of using Stop to end a program, use Return. Stop ends program running entirely, including all programs that might be also running it (so if this is, say, a subprogram in a more giant math helper program, that program will also stop). Return, however, only ends the current program that is running, leaving any main programs alone.
    ▪ For goodness sake, man, close your If X:Then constructions with an End! Only solitary If X statements don't need an End at the end, but if you use Then, use End to end it after the conditional operation is done.
    ▪ As far as using Lbls, it's unavoidable with Menus. That's just how they work. Apart from this, however, it's still usually good practice to avoid Lbls and Gotos whenever you can. There is always a way to write any code with labels as a set of looping/conditional statements.

Hope this helps you code bigger and better things!
Benjamin21302 wrote:
Thanks _iPhoenix_!

I thought about making multiple programs, but if I use the "rcl" function will it hide the extra programs from my list? I hate having a long list of programs on my calculator. If I lock them with this button http://imgur.com/a/hrkx3 will they not show up?

Thanks again,

-Ben

RCL isn't a code instruction; it's actually a way to basically copy the entire contents of any other program or variable at the current spot in the program. This does not affect the original program/variable at all, meaning if you recalled the contents of a variable and wanted to destroy the original, you'd have to do that yourself.

This button locks or unlocks the program from being able to be edited (if you, say, wanted to protect the program from being edited by careless or mischievous students). You will still see it in your programs list as being able to be executed, but it simply hides that program from the editable programs list.

Hope I helped!
If you lock a program, it is not able to be edited on-calc.
Edit: I posted this first, JWinslow just edited it in to his post Razz

When you are fully done with your program (after the recall, and you don't want to add/edit), you can delete the programs.

Having lots of programs on my calculator quickly becomes something I have to deal with, but you can use [Alpha]*first letter of program's name* to skip to that section of your program list.

If you are using SC3, then the whole need of having other programs is somewhat useless, but on-calc it is much easier, I have found.
I would look into using the Menu( command to create a menu at the beginning of the program that will allow the user to select which part they want to use. After that part of the program is completed, you can use Goto to jump back to a label before the menu. Instead of creating all of the individual functions inside of a single program, it may be easier to create a separate program for each component before combining the using recall ([2nd][sto->]) to paste their contents into one program with a menu.

Additionally, commands to compute the LCM and GCD can be found under NUM math menu ([MATH][>]).
jonbush wrote:
Additionally, commands to compute the LCM and GCD can be found under NUM math menu ([MATH][>]).

He knows about this; he uses them in the functionality of the program that computes them.
Thanks for all the replies everyone! I already learned a lot and I haven't even finished reading them. Cemetech is such a great resource for coding help. Smile

-Ben
Benjamin21302 wrote:
Thanks for all the replies everyone! I already learned a lot and I haven't even finished reading them. Cemetech is such a great resource for coding help. Smile

-Ben


We try, we try.

We were all once like this, at one point, and most of us had to get help, too.
I try to help as much as I can because I remember how much the community helped me (heck, this wasn't even all that long ago) and I want to be a part of that.
_iPhoenix_ wrote:
Benjamin21302 wrote:
Thanks for all the replies everyone! I already learned a lot and I haven't even finished reading them. Cemetech is such a great resource for coding help. Smile

-Ben


We try, we try.

We were all once like this, at one point, and most of us had to get help, too.
I try to help as much as I can because I remember how much the community helped me (heck, this wasn't even all that long ago) and I want to be a part of that.

Indeed, I remember when I was still leaving my If statements without 'End's.
For a general resource in TI-BASIC commands and syntax, I recommend the pages at tibasicdev.wikidot.com. Surfing through the site was a major source of inspiration and insight. In addition to the index I linked, they have many tutorials, tips, and techniques for beginning and advanced programmers. Good luck coding!
  
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 GMT - 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