Is anyone familiar with the Bacon number?
Now is anyone familiar with the notion that when you spell out a number, its value is 4. For example, 3 is "three." "Three" has 5 letters. "Five" has 4. Every number will lead to four. I am making a program that traces how many steps it takes to get to four.
I am currently doing pretty well, but I can's seem to re run the program without it freezing, ultimately signalling it is in an infinite loop. This is the code.
Public Class Form1
Dim intInput, intNumber, intCounter, intFinalCount As Integer
Dim strWord As String
Function count()
For Each singleChar In strWord
intCounter += 1
Next
Select Case intCounter
Case 1
strWord = "one"
Case 2
strWord = "two"
Case 3
strWord = "three"
Case 4
strWord = "four"
Case 5
strWord = "five"
Case 6
strWord = "six"
End Select
End Function
Function count2()
Select Case intCounter
Case 1
strWord = "one"
Case 2
strWord = "two"
Case 3
strWord = "three"
Case 4
strWord = "four"
Case 5
strWord = "five"
Case 6
strWord = "six"
End Select
End Function
Private Sub btnPomeranz_Click(sender As Object, e As EventArgs) Handles btnPomeranz.Click
intInput = 0
intNumber = 0
intFinalCount = 0
strWord = ""
intCounter = 0
If txtKershaw.Text <> "" Then
intInput = txtKershaw.Text
Else
Close()
End If
intNumber = intInput
count2()
count()
Do While intCounter <> 4
If intCounter <> 4 Then
count()
intFinalCount += 1
End If
Loop
lblKluber.Text = intFinalCount
End Sub
End Class