Periodic table: Difference between revisions
Content added Content deleted
(Major edit) |
|||
Line 312: | Line 312: | ||
Atomic number 113 -> 7, 13</pre> |
Atomic number 113 -> 7, 13</pre> |
||
==={{header|FutureBasic}}=== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
_window = 1 |
|||
void local fn BuildPeriodicTableArrays |
|||
CFArrayRef periodicArr = @[@"",¬ |
|||
@"H", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"He",¬ |
|||
@"Li", @"Be", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"B", @"C", @"N", @"O", @"F", @"Ne",¬ |
|||
@"Na", @"Mg", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"Al", @"Si", @"P", @"S", @"Cl", @"Ar",¬ |
|||
@"K", @"Ca", @"Sc", @"Ti", @"V", @"Cr", @"Mn", @"Fe", @"Co", @"Ni", @"Cu", @"Zn", @"Ga", @"Ge", @"As", @"Se", @"Br", @"Kr",¬ |
|||
@"Rb", @"Sr", @"Y", @"Zr", @"Nb", @"Mo", @"Tc", @"Ru", @"Rh", @"Pd", @"Ag", @"Cd", @"In", @"Sn", @"Sb", @"Te", @"I", @"Xe",¬ |
|||
@"Cs", @"Ba", @"Lu", @"Hf", @"Ta", @"W", @"Re", @"Os", @"Ir", @"Pt", @"Au", @"Hg", @"Tl", @"Pb", @"Bi", @"Po", @"At", @"Rn",¬ |
|||
@"Fr", @"Ra", @"Lr", @"Rf", @"Db", @"Sg", @"Bh", @"Hs", @"Mt", @"Ds", @"Rg", @"Cn", @"Nh", @"Fl", @"Mc", @"Lv", @"Ts", @"Og",¬ |
|||
@"", @"", @"La", @"Ce", @"Pr", @"Nd", @"Pm", @"Sm", @"Eu", @"Gd", @"Tb", @"Dy", @"Ho", @"Er", @"Tm", @"Yb", @"", @"",¬ |
|||
@"", @"", @"Ac", @"Th", @"Pa", @"U", @"NP", @"Pu", @"Am", @"Cm", @"Bk", @"Cf", @"Es", @"Fm", @"Md", @"No", @"", @""] |
|||
AppSetProperty( @"periodicTable", periodicArr ) |
|||
CFArrayRef numbersArr = @[@"",¬ |
|||
@"1", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"2",¬ |
|||
@"3", @"4", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"5", @"6", @"7", @"8", @"9", @"10",¬ |
|||
@"11", @"12", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"13", @"14", @"15", @"16", @"17", @"18",¬ |
|||
@"19", @"20", @"21", @"22", @"23", @"24", @"25", @"26", @"27", @"28", @"29", @"30", @"31", @"32", @"33", @"34", @"35", @"36",¬ |
|||
@"37", @"38", @"39", @"40", @"41", @"42", @"43", @"44", @"45", @"46", @"47", @"48", @"49", @"50", @"51", @"52", @"53", @"54",¬ |
|||
@"55", @"56", @"71", @"72", @"73", @"74", @"75", @"76", @"77", @"78", @"79", @"80", @"81", @"82", @"83", @"84", @"85", @"86",¬ |
|||
@"87", @"88", @"103", @"104", @"105", @"106", @"107", @"108", @"109", @"110", @"111", @"112", @"113", @"114", @"114", @"116", @"117", @"118",¬ |
|||
@"", @"", @"57", @"58", @"59", @"60", @"61", @"62", @"63", @"64", @"65", @"66", @"67", @"68", @"59", @"70", @"", @"",¬ |
|||
@"", @"", @"89", @"90", @"91", @"92", @"93", @"94", @"95", @"96", @"97", @"98", @"99", @"100", @"101", @"102", @"", @""] |
|||
AppSetProperty( @"periodicNumbers", numbersArr ) |
|||
end fn |
|||
void local fn BuildWindow |
|||
NSInteger i, j, row |
|||
CGRect r |
|||
CFArrayRef periodicArr, numbersArr |
|||
CFStringRef tempStr |
|||
periodicArr = fn AppProperty( @"periodicTable" ) |
|||
numbersArr = fn AppProperty( @"periodicNumbers" ) |
|||
window _window, @"Periodic Table", ( 0, 0, 700, 400 ) |
|||
WindowSetBackgroundColor( _window, fn ColorWhite ) |
|||
j = 0 : row = 350 |
|||
r = fn CGRectMake( 10, row, 36, 40 ) |
|||
for i = 1 to 162 |
|||
if fn StringIsEqual( periodicArr[i], @"" ) then tempStr = @"" else tempStr = fn StringWithFormat( @"%@\n%@", numbersArr[i], periodicArr[i] ) |
|||
textfield i,, tempStr, r, _window |
|||
TextFieldSetBackgroundColor( i, fn ColorBlue ) |
|||
TextFieldSetTextColor( i, fn ColorWhite ) |
|||
ControlSetFontWithName( i, @"Menlo", 12.0 ) |
|||
ControlSetAlignment(i, NSTextAlignmentCenter ) |
|||
r = fn CGRectOffset( r, 38, 0 ) |
|||
j++ |
|||
if ( j == 18 ) |
|||
row = row - 42 |
|||
r = fn CGRectMake( 10, row, 36, 40 ) |
|||
j = 0 |
|||
end if |
|||
next |
|||
for i = 1 to 162 |
|||
if fn StringIsEqual( fn ControlStringValue( i ), @"" ) then ViewRemoveFromSuperview( i ) |
|||
next |
|||
end fn |
|||
fn BuildPeriodicTableArrays |
|||
fn BuildWindow |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
{{output}} |
|||
[[File:Periodic Table FutureBasic.png]] |
|||
==={{header|Gambas}}=== |
==={{header|Gambas}}=== |
||
Line 788: | Line 714: | ||
{{out}} |
{{out}} |
||
<pre>Same as FreeBASIC entry.</pre> |
<pre>Same as FreeBASIC entry.</pre> |
||
=={{header|FutureBasic}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
_window = 1 |
|||
void local fn BuildPeriodicTableArrays |
|||
CFArrayRef periodicArr = @[@"",¬ |
|||
@"H", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"He",¬ |
|||
@"Li", @"Be", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"B", @"C", @"N", @"O", @"F", @"Ne",¬ |
|||
@"Na", @"Mg", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"Al", @"Si", @"P", @"S", @"Cl", @"Ar",¬ |
|||
@"K", @"Ca", @"Sc", @"Ti", @"V", @"Cr", @"Mn", @"Fe", @"Co", @"Ni", @"Cu", @"Zn", @"Ga", @"Ge", @"As", @"Se", @"Br", @"Kr",¬ |
|||
@"Rb", @"Sr", @"Y", @"Zr", @"Nb", @"Mo", @"Tc", @"Ru", @"Rh", @"Pd", @"Ag", @"Cd", @"In", @"Sn", @"Sb", @"Te", @"I", @"Xe",¬ |
|||
@"Cs", @"Ba", @"Lu", @"Hf", @"Ta", @"W", @"Re", @"Os", @"Ir", @"Pt", @"Au", @"Hg", @"Tl", @"Pb", @"Bi", @"Po", @"At", @"Rn",¬ |
|||
@"Fr", @"Ra", @"Lr", @"Rf", @"Db", @"Sg", @"Bh", @"Hs", @"Mt", @"Ds", @"Rg", @"Cn", @"Nh", @"Fl", @"Mc", @"Lv", @"Ts", @"Og",¬ |
|||
@"", @"", @"La", @"Ce", @"Pr", @"Nd", @"Pm", @"Sm", @"Eu", @"Gd", @"Tb", @"Dy", @"Ho", @"Er", @"Tm", @"Yb", @"", @"",¬ |
|||
@"", @"", @"Ac", @"Th", @"Pa", @"U", @"NP", @"Pu", @"Am", @"Cm", @"Bk", @"Cf", @"Es", @"Fm", @"Md", @"No", @"", @""] |
|||
AppSetProperty( @"periodicTable", periodicArr ) |
|||
CFArrayRef numbersArr = @[@"",¬ |
|||
@"1", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"2",¬ |
|||
@"3", @"4", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"5", @"6", @"7", @"8", @"9", @"10",¬ |
|||
@"11", @"12", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"13", @"14", @"15", @"16", @"17", @"18",¬ |
|||
@"19", @"20", @"21", @"22", @"23", @"24", @"25", @"26", @"27", @"28", @"29", @"30", @"31", @"32", @"33", @"34", @"35", @"36",¬ |
|||
@"37", @"38", @"39", @"40", @"41", @"42", @"43", @"44", @"45", @"46", @"47", @"48", @"49", @"50", @"51", @"52", @"53", @"54",¬ |
|||
@"55", @"56", @"71", @"72", @"73", @"74", @"75", @"76", @"77", @"78", @"79", @"80", @"81", @"82", @"83", @"84", @"85", @"86",¬ |
|||
@"87", @"88", @"103", @"104", @"105", @"106", @"107", @"108", @"109", @"110", @"111", @"112", @"113", @"114", @"114", @"116", @"117", @"118",¬ |
|||
@"", @"", @"57", @"58", @"59", @"60", @"61", @"62", @"63", @"64", @"65", @"66", @"67", @"68", @"59", @"70", @"", @"",¬ |
|||
@"", @"", @"89", @"90", @"91", @"92", @"93", @"94", @"95", @"96", @"97", @"98", @"99", @"100", @"101", @"102", @"", @""] |
|||
AppSetProperty( @"periodicNumbers", numbersArr ) |
|||
end fn |
|||
void local fn BuildWindow |
|||
NSInteger i, j, row |
|||
CGRect r |
|||
CFArrayRef periodicArr, numbersArr |
|||
CFStringRef tempStr |
|||
periodicArr = fn AppProperty( @"periodicTable" ) |
|||
numbersArr = fn AppProperty( @"periodicNumbers" ) |
|||
window _window, @"Periodic Table", ( 0, 0, 700, 400 ) |
|||
WindowSetBackgroundColor( _window, fn ColorWhite ) |
|||
j = 0 : row = 350 |
|||
r = fn CGRectMake( 10, row, 36, 40 ) |
|||
for i = 1 to 162 |
|||
if fn StringIsEqual( periodicArr[i], @"" ) then tempStr = @"" else tempStr = fn StringWithFormat( @"%@\n%@", numbersArr[i], periodicArr[i] ) |
|||
textfield i,, tempStr, r, _window |
|||
TextFieldSetBackgroundColor( i, fn ColorBlue ) |
|||
TextFieldSetTextColor( i, fn ColorWhite ) |
|||
ControlSetFontWithName( i, @"Menlo", 12.0 ) |
|||
ControlSetAlignment(i, NSTextAlignmentCenter ) |
|||
r = fn CGRectOffset( r, 38, 0 ) |
|||
j++ |
|||
if ( j == 18 ) |
|||
row = row - 42 |
|||
r = fn CGRectMake( 10, row, 36, 40 ) |
|||
j = 0 |
|||
end if |
|||
next |
|||
for i = 1 to 162 |
|||
if fn StringIsEqual( fn ControlStringValue( i ), @"" ) then ViewRemoveFromSuperview( i ) |
|||
next |
|||
end fn |
|||
fn BuildPeriodicTableArrays |
|||
fn BuildWindow |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
{{output}} |
|||
[[File:Periodic Table FutureBasic.png]] |
|||
=={{header|Go}}== |
=={{header|Go}}== |