Jump to content

Letter frequency: Difference between revisions

m
Line 5,841:
 
=={{header|S-BASIC}}==
Because S-BASIC lacks an EOF function, some extra care is required to avoid reading beyond the end of file. (CP/M text files are by conventionnormally terminated with a Ctrl-Z byte, but not all text editors enforce this convention if the file would otherwise end on a sector boundary.)
<lang S-BASIC>
$constant EOF = 1AH rem Endnormal end-of-file marker
 
rem Convert character to upper case
Line 5,858:
next p
end = source
 
rem
 
 
comment
Line 5,894 ⟶ 5,891:
if ch >= "A" and ch <= "Z" then
begin
freq(asc(upcase(ch)) - 64) = freq(asc(upcase(ch)) - 64) + 1
total = total + 1
end
input3 #2; ch
end
 
goto 8_done rem Jump around error trap
 
211

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.