Chemical calculator: Difference between revisions

Content added Content deleted
m (→‎{{header|ALGOL W}}: Adjust layout to avoid wrapped lines)
Line 187: Line 187:
real procedure parseCompound ; begin
real procedure parseCompound ; begin
real mass, itemMass;
real mass, itemMass;
% parses an element symbol from the molecule and returns its mass %
% parses an element symbol feom the molecule and retutns its mass %
real procedure parseAtom ; begin
real procedure parseAtom ; begin
string(3) symbol;
string(3) symbol;
Line 265: Line 265:
A("Es",252 );A("Fm",257 ); % Md % %, No % % Lr %
A("Es",252 );A("Fm",257 ); % Md % %, No % % Lr %
end Actinides ;
end Actinides ;
A("Li", 6.94 );A("Na",22.98976928 );A("K", 39.0983 );A("Rb", 85.4678 );A("Cs",132.90545196);A("Fr", 223 );
real CsMass; CsMass := 132.90545196;
A("Be", 9.0121831 );A("Mg",24.305 );A("Ca",40.078 );A("Sr", 87.62 );A("Ba",137.327 );A("Ra", 226 );
A("Li", 6.94 );A("Na",22.98976928 );A("K", 39.0983 );A("Rb", 85.4678 );A("Cs",CsMass );A("Fr",223);
A("Sc",44.955908);A("Y", 88.90584); Lanthanides; Actinides;
A("Be", 9.0121831 );A("Mg",24.305 );A("Ca",40.078 );A("Sr", 87.62 );A("Ba",137.327 );A("Ra",226);
A("Ti",47.867 );A("Zr", 91.224 );A("Hf",178.49 ); % Rf %
A("Sc",44.955908);A("Y", 88.90584);Lanthanides; Actinides;
A("V", 50.9415 );A("Nb", 92.90637);A("Ta",180.94788 ); % Db %
A("Ti",47.867 );A("Zr", 91.224 );A("Hf",178.49 ); % Rf %
A("Cr",51.9961 );A("Mo", 95.95 );A("W", 183.84 ); % Sg %
A("V", 50.9415 );A("Nb", 92.90637);A("Ta",180.94788 ); % Db %
A("Mn",54.938044); % Tc % A("Re",186.207 ); % Bh %
A("Cr",51.9961 );A("Mo", 95.95 );A("W", 183.84 ); % Sg %
A("Fe",55.845 );A("Ru",101.07 );A("Os",190.23 ); % Hs %
A("Mn",54.938044); % Tc % A("Re",186.207 ); % Bh %
A("Co",58.933194);A("Rh",102.9055 );A("Ir",192.217 ); % Mt %
A("Fe",55.845 );A("Ru",101.07 );A("Os",190.23 ); % Hs %
A("Ni",58.6934 );A("Pd",106.42 );A("Pt",195.084 ); % Ds %
A("Co",58.933194);A("Rh",102.9055 );A("Ir",192.217 ); % Mt %
A("Cu",63.546 );A("Ag",107.8682 );A("Au",196.966569 ); % Rg %
A("Ni",58.6934 );A("Pd",106.42 );A("Pt",195.084 ); % Ds %
A("Zn",65.38 );A("Cd",112.414 );A("Hg",200.592 ); % Cn %
A("Cu",63.546 );A("Ag",107.8682 );A("Au",196.966569); % Rg %
A("B", 10.81 );A("Al",26.9815385 );A("Ga",69.723 );A("In",114.818 );A("Tl",204.38 ); % Nh %
A("Zn",65.38 );A("Cd",112.414 );A("Hg",200.592 ); % Cn %
A("C", 12.011 );A("Si",28.085 );A("Ge",72.63 );A("Sn",118.71 );A("Pb",207.2 ); % Fl %
A("B", 10.81 );A("Al",26.9815385 );A("Ga",69.723 );A("In",114.818 );A("Tl",204.38 ); % Nh %
A("N", 14.007 );A("P", 30.973761998);A("As",74.921595);A("Sb",121.76 );A("Bi",208.9804 ); % Ms %
A("C", 12.011 );A("Si",28.085 );A("Ge",72.63 );A("Sn",118.71 );A("Pb",207.2 ); % Fl %
A("O", 15.999 );A("S", 32.06 );A("Se",78.971 );A("Te",127.6 );A("Po",209 ); % Lv %
A("N", 14.007 );A("P", 30.973761998);A("As",74.921595);A("Sb",121.76 );A("Bi",208.9804 ); % Ms %
A("F", 18.998403163);A("Cl",35.45 );A("Br",79.904 );A("I", 126.90447);A("At",210 ); % Ts %
A("O", 15.999 );A("S", 32.06 );A("Se",78.971 );A("Te",127.6 );A("Po",209 ); % Lv %
A("Ne",20.1797 );A("Ar",39.948 );A("Kr",83.798 );A("Xe",131.293 );A("Rn",222 ); % Og %
A("F", 18.998403163);A("Cl",35.45 );A("Br",79.904 );A("I", 126.90447);A("At",210 ); % Ts %
A("Ne",20.1797 );A("Ar",39.948 );A("Kr",83.798 );A("Xe",131.293 );A("Rn",222 ); % Og %
% ---------------- first period elements ---> % A("H", 1.008);A("He", 4.002602);
% ---------------- first period elements ---> % A("H", 1.008);A("He", 4.002602);
% --- hypothetical eigth period elements ---> % A("Uue",315 );A("Ubn",299 );
% --- hypothetical eigth period elements ---> % A("Uue",315 );A("Ubn",299 );
Line 313: Line 314:
UueCl : 350.450
UueCl : 350.450
</pre>
</pre>

=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
<syntaxhighlight lang="autohotkey">test := ["H", "H2", "H2O", "H2O2", "(HO)2", "Na2SO4", "C6H12", "COOH(C(CH3)2)3CH3", "C6H4O2(OH)4", "C27H46O"
<syntaxhighlight lang="autohotkey">test := ["H", "H2", "H2O", "H2O2", "(HO)2", "Na2SO4", "C6H12", "COOH(C(CH3)2)3CH3", "C6H4O2(OH)4", "C27H46O"