Letter frequency: Difference between revisions
Content added Content deleted
Line 5,841: | Line 5,841: | ||
=={{header|S-BASIC}}== |
=={{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 |
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 normally 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> |
<lang S-BASIC> |
||
$constant EOF = 1AH rem |
$constant EOF = 1AH rem normal end-of-file marker |
||
rem Convert character to upper case |
rem Convert character to upper case |
||
Line 5,858: | Line 5,858: | ||
next p |
next p |
||
end = source |
end = source |
||
rem |
|||
comment |
comment |
||
Line 5,894: | Line 5,891: | ||
if ch >= "A" and ch <= "Z" then |
if ch >= "A" and ch <= "Z" then |
||
begin |
begin |
||
freq |
freq(ch - 64) = freq(ch - 64) + 1 |
||
total = total + 1 |
total = total + 1 |
||
end |
end |
||
input3 #2; ch |
input3 #2; ch |
||
end |
end |
||
goto 8_done rem Jump around error trap |
goto 8_done rem Jump around error trap |
||