So I have been trying to make a program to factor any polynomial expression by inputting a string. When making the code to check to see if I can factor out an X, I got stuck when I realized there must be a way to individually change one letter of a string. Is this possible?
Yes; the option I can think of right now is to cut the string into two pieces using substrings, add in the character, and reassemble the string, as in this pseudocode:
TI-83 series - :sub(string,1,position-1)+yourstring+sub(string,position+1,length(string)-position
TI-89 series - :left(string,position-1)&yourstring&right(string,position+1)

This will error out if the position is 1 or length(string); it only works for characters that are not the first or last.
im on ti 84.
Thanks, I prob coulda thought of that given enough time
The TI-84 Plus series is a member of the TI-83 series, and thus the above code will work.
CVSoft wrote:
The TI-84 Plus series is a member of the TI-83 series, and thus the above code will work.


IK that.
It's worth mentioning that that method will not work properly on the very first or very last character in a string. Often people will write special cases for those, or pad strings on both ends and later remove the padding.
  
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