29 lines
542 B
Plaintext
29 lines
542 B
Plaintext
' FB 1.05.0 Win64
|
|
|
|
Dim a(65 to 90) As Integer ' array to hold frequency of each letter, all elements zero initially
|
|
Dim fileName As String = "input.txt"
|
|
Dim s As String
|
|
Dim i As Integer
|
|
Open fileName For Input As #1
|
|
|
|
While Not Eof(1)
|
|
Line Input #1, s
|
|
s = UCase(s)
|
|
For i = 0 To Len(s) - 1
|
|
a(s[i]) += 1
|
|
Next
|
|
Wend
|
|
|
|
Close #1
|
|
|
|
Print "The frequency of each letter in the file "; fileName; " is as follows:"
|
|
Print
|
|
For i = 65 To 90
|
|
If a(i) > 0 Then
|
|
Print Chr(i); " : "; a(i)
|
|
End If
|
|
Next
|
|
Print
|
|
Print "Press any key to quit"
|
|
Sleep
|