Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Letter-frequency/FreeBASIC/letter-frequency.basic
Normal file
28
Task/Letter-frequency/FreeBASIC/letter-frequency.basic
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
' 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue