langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
24
Task/Letter-frequency/Pascal/letter-frequency.pascal
Normal file
24
Task/Letter-frequency/Pascal/letter-frequency.pascal
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
program LetterFrequency;
|
||||
var
|
||||
textFile: text;
|
||||
character: char;
|
||||
counter: array[0..255] of integer;
|
||||
i: integer;
|
||||
begin
|
||||
for i := low(counter) to high(counter) do
|
||||
counter[i] := 0;
|
||||
assign(textFile, 'a_text_file.txt');
|
||||
reset(textFile);
|
||||
while not eof(textFile) do
|
||||
begin
|
||||
while not eoln(textFile) do
|
||||
begin
|
||||
read(textFile, character);
|
||||
inc(counter[ord(character)]);
|
||||
end;
|
||||
readln(textFile);
|
||||
end;
|
||||
for i := low(counter) to high(counter) do
|
||||
if counter[i] > 0 then
|
||||
writeln(char(i), ': ', counter[i]);
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue