Old Russian measure of length: Difference between revisions

Dialects of BASIC moved to the BASIC section.
(Dialects of BASIC moved to the BASIC section.)
Line 515:
</pre>
 
=={{header|BBC BASIC}}==
==={{header|BBC BASIC}}===
<syntaxhighlight lang="bbcbasic">REM >oldrussian
@% = &90E
Line 570 ⟶ 571:
2800 liniya
28000 tochka</pre>
 
==={{header|FreeBASIC}}===
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64
 
Dim units(1 To 13) As String = {"tochka", "liniya", "dyuim", "vershok", "piad", "fut", _
"arshin", "sazhen", "versta", "milia", _
"centimeter", "meter", "kilometer"}
 
' all expressed in centimeters
Dim convs(1 To 13) As Single = {0.0254, 0.254, 2.54, 4.445, 17.78, 30.48, _
71.12, 213.36, 10668, 74676, _
1, 100, 10000}
Dim unit As Integer
Dim value As Single
Dim yn As String
 
Do
Shell("cls")
Print
For i As Integer = 1 To 13
Print Using "##"; i;
Print " "; units(i)
Next
Print
Do
Input "Please choose a unit 1 to 13 : "; unit
Loop Until unit >= 1 AndAlso unit <= 13
Print
Do
Input "Now enter a value in that unit : "; value
Loop Until value >= 0
Print
Print "The equivalent in the remaining units is : "
Print
For i As Integer = 1 To 13
If i = unit Then Continue For
Print " "; units(i), " : "; value * convs(unit) / convs(i)
Next
Print
Do
Input "Do another one y/n : "; yn
yn = LCase(yn)
Loop Until yn = "y" OrElse yn = "n"
Loop Until yn = "n"
End</syntaxhighlight>
Sample input/output:
{{out}}
<pre>
 
1 tochka
2 liniya
3 dyuim
4 vershok
5 piad
6 fut
7 arshin
8 sazhen
9 versta
10 milia
11 centimeter
12 meter
13 kilometer
 
Please choose a unit 1 to 13 : ? 13
 
Now enter a value in that unit : ? 1
 
The equivalent in the remaining units is :
 
tochka : 393700.8
liniya : 39370.08
dyuim : 3937.008
vershok : 2249.719
piad : 562.4297
fut : 328.084
arshin : 140.6074
sazhen : 46.86914
versta : 0.9373828
milia : 0.1339118
centimeter : 10000
meter : 100
 
Do another one y/n : ? n
</pre>
 
=={{header|C}}==
Line 1,128 ⟶ 1,214:
10.000 arshin</pre>
 
=={{header|FreeBASIC}}==
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64
 
Dim units(1 To 13) As String = {"tochka", "liniya", "dyuim", "vershok", "piad", "fut", _
"arshin", "sazhen", "versta", "milia", _
"centimeter", "meter", "kilometer"}
 
' all expressed in centimeters
Dim convs(1 To 13) As Single = {0.0254, 0.254, 2.54, 4.445, 17.78, 30.48, _
71.12, 213.36, 10668, 74676, _
1, 100, 10000}
Dim unit As Integer
Dim value As Single
Dim yn As String
 
Do
Shell("cls")
Print
For i As Integer = 1 To 13
Print Using "##"; i;
Print " "; units(i)
Next
Print
Do
Input "Please choose a unit 1 to 13 : "; unit
Loop Until unit >= 1 AndAlso unit <= 13
Print
Do
Input "Now enter a value in that unit : "; value
Loop Until value >= 0
Print
Print "The equivalent in the remaining units is : "
Print
For i As Integer = 1 To 13
If i = unit Then Continue For
Print " "; units(i), " : "; value * convs(unit) / convs(i)
Next
Print
Do
Input "Do another one y/n : "; yn
yn = LCase(yn)
Loop Until yn = "y" OrElse yn = "n"
Loop Until yn = "n"
End</syntaxhighlight>
Sample input/output:
{{out}}
<pre>
 
1 tochka
2 liniya
3 dyuim
4 vershok
5 piad
6 fut
7 arshin
8 sazhen
9 versta
10 milia
11 centimeter
12 meter
13 kilometer
 
Please choose a unit 1 to 13 : ? 13
 
Now enter a value in that unit : ? 1
 
The equivalent in the remaining units is :
 
tochka : 393700.8
liniya : 39370.08
dyuim : 3937.008
vershok : 2249.719
piad : 562.4297
fut : 328.084
arshin : 140.6074
sazhen : 46.86914
versta : 0.9373828
milia : 0.1339118
centimeter : 10000
meter : 100
 
Do another one y/n : ? n
</pre>
=={{header|Forth}}==
Tested with GForth.
512

edits