Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
|
|
@ -0,0 +1,61 @@
|
|||
Type E
|
||||
As Integer _valor, _contar
|
||||
|
||||
Public:
|
||||
Declare Sub Constructor_(value As Integer, count As Integer)
|
||||
Declare Function Valor() As Integer
|
||||
Declare Function Contar() As Integer
|
||||
Declare Sub Hailstone()
|
||||
End Type
|
||||
|
||||
Sub E.Constructor_(value As Integer, count As Integer)
|
||||
This._valor = value
|
||||
This._contar = count
|
||||
End Sub
|
||||
|
||||
Function E.Valor() As Integer
|
||||
Return This._valor
|
||||
End Function
|
||||
|
||||
Function E.Contar() As Integer
|
||||
Return This._contar
|
||||
End Function
|
||||
|
||||
Sub E.Hailstone()
|
||||
Print Using "####"; This._valor;
|
||||
If (This._valor = 1) Then Exit Sub
|
||||
This._contar = This._contar + 1
|
||||
This._valor = Iif(This._valor Mod 2 = 0, This._valor \ 2, 3 * This._valor + 1)
|
||||
End Sub
|
||||
|
||||
|
||||
Dim As Integer jobs = 12
|
||||
Dim As E envs(jobs)
|
||||
|
||||
For i As Integer = 0 To jobs - 1
|
||||
envs(i).Constructor_(i + 1, 0)
|
||||
Next i
|
||||
|
||||
Print "Sequences:"
|
||||
Dim As Integer done = 0
|
||||
While done = 0
|
||||
For i As Integer = 0 To jobs - 1
|
||||
envs(i).Hailstone()
|
||||
Next i
|
||||
Print
|
||||
done = 1
|
||||
For i As Integer = 0 To jobs - 1
|
||||
If envs(i).Valor() <> 1 Then
|
||||
done = 0
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
Wend
|
||||
|
||||
Print "Counts:"
|
||||
For i As Integer = 0 To jobs - 1
|
||||
Print Using "####"; envs(i).Contar();
|
||||
Next i
|
||||
Print
|
||||
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue