Old Russian measure of length: Difference between revisions
Content added Content deleted
m (→{{header|J}}: Use debian standard install location for J) |
No edit summary |
||
Line 1,784: | Line 1,784: | ||
Do another one y/n : n |
Do another one y/n : n |
||
</pre> |
</pre> |
||
=={{header|M2000 Interpreter}}== |
|||
<syntaxhighlight lang="m2000 interpreter"> |
|||
module OldRusianMeasureOfLength { |
|||
unit2mult=list:="arshin" := 0.7112, "centimeter" := 0.01, "diuym" := 0.0254, "fut" := 0.3048, "kilometer" := 1000.0, "liniya" := 0.00254, "meter" := 1.0, "milia" := 7467.6, "piad" := 0.1778, "sazhen" := 2.1336, "tochka":= 0.000254, "vershok" := 0.04445, "versta" := 1066.8 |
|||
k=each(unit2mult) |
|||
menu // empty menu list |
|||
menu + "(exit)" |
|||
while k |
|||
menu + eval$(k!) |
|||
end while |
|||
double v |
|||
do |
|||
Print "Value, Unit"; |
|||
input ":", v; |
|||
print " "; |
|||
menu ! |
|||
if menu>0 then |
|||
print menu$(menu) |
|||
if menu$(menu)="(exit)" then exit |
|||
Print v;" ";menu$(menu);" to:" |
|||
v*=unit2mult(menu$(menu)) |
|||
k=each(unit2mult) |
|||
while k |
|||
if eval$(k!)=menu$(menu) then continue |
|||
print format$("{0:-12}: {1}",eval$(k!), round(v/eval(k),9)) |
|||
end while |
|||
else |
|||
exit |
|||
end if |
|||
always |
|||
} |
|||
OldRusianMeasureOfLength |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
1 meter to: |
|||
arshin: 1.406074241 |
|||
centimeter: 100 |
|||
diuym: 39.37007874 |
|||
fut: 3.280839895 |
|||
kilometer: 0.001 |
|||
liniya: 393.700787402 |
|||
meter: 1 |
|||
milia: 0.000133912 |
|||
piad: 5.624296963 |
|||
sazhen: 0.468691414 |
|||
tochka: 3937.007874016 |
|||
vershok: 22.497187852 |
|||
versta: 0.000937383 |
|||
</pre> |
|||
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
=={{header|Mathematica}} / {{header|Wolfram Language}}== |