Author | Comment |
Joemakerman Marine Posted: 15 Jan 2008 13:08 GMT Total Posts: 15 | I figured I would make a program that tells me the area of different shapes as I put in the numbers, and it calculates the area according to an equation for the area that I put in the code. (I'm doing this for geometry, so its easier that trying to figure it all out myself). Well, I tried a simple shape, that I already knew, just to test it. I picked a square. Heres the code so far (Notice, I plan to add to the menu):
:clrhome :lbl 9 :Menu("Menu","Square",1) :lbl 1 :clrhome :prompt w (For width) :prompt L (For length) :A=W*L :Disp A :pause :goto 9
I did that, then went to test it. I put in the numbers 4 and 5 (which is a square with an area of 20). It came out 0. I tried with other sets of numbers, and still got 0. Any idea how I can fix this? Or is this program not possible or something? Thanks.
-Joe
P.S. I plan to submit this program if I can get it working. |
BrandonW Goliath Posted: 15 Jan 2008 13:47 GMT Total Posts: 100 | Change ":A=W*L" to "W*L->A" where "->" is the STO key above ON.
What you have there multiplies W and L together, then tests to see if it's equal to A. That would return 1 if true, and 0 if not. Since it's not true, that's why you get 0. STO-> is for actually storing values to variables.
|
Joemakerman Marine Posted: 15 Jan 2008 15:06 GMT Total Posts: 15 | It worked! Yes! Thanks a bunch! I'll finish it off now and I'll post it up on this site if I can. Have a nice night. |
Vectris Ultralisk
Posted: 15 Jan 2008 17:22 GMT Total Posts: 375 | good idea, but if you want to post it i suggest adding a few more functions than just one area formula, i actually made a large program myself with area, volume, surface area, and various things for graphs such as distance b/w points, i'm just 2 lazy to post it |
Joemakerman Marine Posted: 16 Jan 2008 13:49 GMT Total Posts: 15 | Well, I started a Volume one, I figured I would do that, since it would be smaller in case some people only need one or so, instead of having all of them....
Also, I know how to make it compatible with Mirage, but what about Ion?
-Joe |
Vectris Ultralisk
Posted: 16 Jan 2008 14:37 GMT Total Posts: 375 | hmm dont know, someone just asked this question in another post |
Socks Probe Posted: 2 Mar 2008 06:58 GMT Total Posts: 5 | Ion can't display Basic programs. I don't know why, but it can't.
Also, why do you have length and width for a square? Those are for a rectangle/||gram.
And, a random optimization - get rid of the * in the code - LW->A works, because the calculator understands implicit multiplication. Also, you can do math in a Disp " command:
:Disp "AREA:",LW
OK, done with my random list of things.
--- Revenge is a dish best served cold... Just like ice cream! |