I'm trying to write a program to calculate the vertex of a parabola. Everything works just fine, but I face trouble when trying to output my answer. I would really like for it to output an ordered pair (h, k), substituting h and k for variables I have calculated. I have seen methods of converting numbers to strings, but when I tried using these methods, it gave me non-real errors. Is there any way I can output an ordered pair with variables as the coordinates?
Welcome to Cemetech, Cammie827! Are we talking about Prizm C or Prizm BASIC? I assume the latter, probably. Can you show us the code you tried to use for the output that gave you the non-real error?
Sure I can!

Code:
For 1+Int log H→I To 1 Step -1
Str 2+StrMid("0123456789",1+Int (10Frac (N/10^I)),1)→Str 2
Next


And yes, I am using BASIC
Sorry for the double post, but i'm really stuck on this. Can anybody help?
The only thing I can think of in your code that could cause a non-real answer error would be that logarithm there; is it possible you're taking log 0 and/or did not initialize H properly? I notice you use both H and N there, when I think you intend to just use one.
The N was just a typo, sorry for that. I've rewritten the code in my calculator assuming it was also a typo, and now I have it working, until I put in a negative. I can easily use the absolute value, and add a "-" to the string, so that's no issue. However, putting in a decimal results in only displaying the whole number part. How can I get it to add the decimal, too?
You can perhaps find a low enough decimal point and start your string from there, and add in the decimal point just before when it reaches the 10^0th place.
  
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