TIB: Reply on Chemistry Lab help


[Prev][Next][Index][Thread]

TIB: Reply on Chemistry Lab help




Depending on your calculator, you could store the elements in a string:

"ab.c.d:abcd..."
a=element number from "  1" to "110"
b=element abbreviation i.e.  "H","He","Une"...
c=element name i.e. "Hydrogen","Helium"...
d=other things like electrons, protons, shells, whatever

pseudocode:
LBLTOP
ask user if he wants to search by number, abbreviation, or name
if number then goto LBLNUMBER
if abbreviation then goto LBLABB
if name then goto LBLNAME
goto LBLTOP
LBLNUMBER
ask user the number of the search
change the number into a string
add a space in front if string number is less than 3
add a space in front if string number is less than 3
add a colon to the front of string number
search string for string number and return in LOCATION
goto LBLDISPLAY
LBLABB
ask user the abbreviation to search
add a period after abbreviation
search string for abbreviation and return in LOCATION
subtract 4 from LOCATION
goto LBLDISPLAY
LBLNAME
ask user the name of the search
add a period before and after the name
search string for name and return in LOCATION
LBLREPEAT
if middle of string at LOCATION does have a colon then goto LBLDISPLAY
subtract one from LOCATION
goto LBLREPEAT
LBLDISPLAY
if string at LOCATION is a colon then add 1 to LOCATION
display the contents from string at LOCATION accordingly (check for 
periods at the end of the abbreviation and name, a colon represents the 
end of that element)
goto LBLTOP

for example, the string might look like this:
"  1H.Hydrogen.0:  2He.Helium.1:..."
and the display may look something like this:

]{LOCATION,3}  {LOCATION+3,"."}  {LOCATION+"."+1,"."}
]{LOCATION,3} protons
]{LOCATION,3} electrons
]  {LOCATION+"."+"."+1,":"} neutrons

looks like for Hydrogen:

  1  H  Hydrogen
  1  protons
  1  electrons
  0  neutrons

looks like for Helium:

  2  He  Helium
  2  protons
  2  electrons
  1  neutrons

-Rob
p.s.  I said that it depends on the calculator, can be done on 85's and 
92's as far as I know (that's all I have).

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com