Hello guys,
I've been looking everywhere and reading tutorials all over, but I can't seem to find how it's done.

How do I write what I want.. hmm.. let me give you an example..

- Input "How many occurring isotopes?", A

- then, if the user types "2" , it will display:
:Input "E-X AMU MASS: ",A
:Input "E-X ABUNDCE PER100: ",P

:ClrHome
:Input "E-Y AMU MASS: ",M
:Input "E-Y ABUNDCE PER100",Q

... Then it will do the calculations..



- but if the user types 3, then it will display:

:Input "ELMNT 1 ABNDCE P100",S
:Input "ELMNT 1 MASS",T
: (S)(T)→T

:ClrHome
:Input "ELMNT 2 ABNDCE P100 ",U
:Input "ELMNT 2 MASS",V
: (U)(V)→V

:ClrHome
:Input "ELMNT 3 ABNDCE P100 ",W
:Input "ELMNT 3 MASS",X
: (W)(X)→X
:T+V+X→Z

:ClrHome
:Disp Z
:Pause


- and if user types 4, then he will have to type 4 amu, and 4 percentages to input..
What im asking here, is how can I have it automatically have the user ask how many, and then once the user has typed how many then ask him to input "those" many, and then let me code the calculation.
Instead of having to make a menu of.. "You have","1",2","3,"4,"5..... etc


By the way, this is for the TI84+ silver edition.
You could do a loop, either While or Repeat would work for this.

Create a list with the dimensions based on the value given for the 'how many', and you can just reuse the same variables for most of it, need one to keep track which list element it is now working on.. And I think that would be it! Smile
tifreak8x wrote:
You could do a loop, either While or Repeat would work for this.

Create a list with the dimensions based on the value given for the 'how many', and you can just reuse the same variables for most of it, need one to keep track which list element it is now working on.. And I think that would be it! Smile


Could you show me how that would be done please
Question, you have multiplication going on in the second example, but not the first. Will it be doing the multiplication like the 2nd example every time, or no?
tifreak8x wrote:
Question, you have multiplication going on in the second example, but not the first. Will it be doing the multiplication like the 2nd example every time, or no?


It's all the same.
Honestly I just want to learn how it's done to be able to do it to more apps in the future. That's my main goal.

Anyways,
This is essentially just:
- For one occurring
Elelment Abundance in percent, E
Element's mass, M

Then you do M*E-->X
Display X
and that's it.

but if you have more than 1 occurring, it would be
Elelment Abundance in percent, E2
Element's mass, M2
M*E -->X
M2*E2 -->Y

Y+X --> Z

Display Z


..... in other words, you multiply them.. and once they have been multiplied, you add them together.
Well.. To get the multiple bits down:


Code:

Input "How many?",A
A->dim(|LISO1
A->dim(|LISO2
1->A
While A<dim(|LISO1
Disp A
Input "E-X AMU MASS: ",B
Input "E-X ABUNDCE PER100: ",C
B->|LISO1(A
C->|LISO2(A
A+1->A
ClrHome
End


Then from there, you can manipulate the values of the lists rather easily, just like you do with the variables. To recall the 3rd place in a list, the format is |LISO(3).

On a side note, |L is denoting the small L used for naming lists, found by pressing [2nd] [STAT] [>] [B].

Code:
:Input "No. of isotopes?",X
:DelVar L₁DelVar L₂For(X,1,X
:Disp "","For element...",X
:Input "Abund. in pcent?",Y
:Y→L₁(X
:Input "Mass in percent?",Y
:Y→L₂(X
:End
:sum(L₁L₂
Thank you guys.
That worked perfectly.

I have never done anything with Lists, by looking at your examples, I am learning a bit about them.

Is there any tutorial that out there that explains this a bit more? sort of related to my question.
All the List and String tutorials I have seen (about 10) are all related to games..
I don't go that far into lists and string, but have you seen "Programming the TI-83 Plus/TI-84 Plus"? Also, welcome to Cemetech, and I'm glad this issue got straightened out. Feel free to introduce yourself in our topic for that purpose if you haven't already.
KermMartian wrote:
I don't go that far into lists and string, but have you seen "Programming the TI-83 Plus/TI-84 Plus"? Also, welcome to Cemetech, and I'm glad this issue got straightened out. Feel free to introduce yourself in our topic for that purpose if you haven't already.


Already read that book.
Already knew most of the stuff.

Thanks for the recommendation tho.
I already introduced myself.
That's fair enough, and glad you bought my book. Smile So what sort of things do you want to learn about strings and lists? As you say, there are tons of non-game ways to use them, and we'd be happy to write out a few posts helping you with some of the details.
KermMartian wrote:
That's fair enough, and glad you bought my book. Smile So what sort of things do you want to learn about strings and lists? As you say, there are tons of non-game ways to use them, and we'd be happy to write out a few posts helping you with some of the details.


Mainly what I said above. How to make programs repeat X number of times the user asked.
This would help me a lot in the future coding more stuff.

thanks
and btw, I know I said I knew most of the stuff, but pretty nice well organized book. It's better than most I've seen.
xologist wrote:
KermMartian wrote:
I don't go that far into lists and string, but have you seen "Programming the TI-83 Plus/TI-84 Plus"? Also, welcome to Cemetech, and I'm glad this issue got straightened out. Feel free to introduce yourself in our topic for that purpose if you haven't already.


Already read that book.
Already knew most of the stuff.

Thanks for the recommendation tho.
I already introduced myself.


would be great if have something to TI-NSPIRE, dont u think!?
  
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