Category : Word Processors
Archive   : COUNTLTR.ZIP
Filename : CONCORDA.PAS

 
Output of file : CONCORDA.PAS contained in archive : COUNTLTR.ZIP
{$R+}
program CONCORDANCE;

{Finds and prints the number of occurrences of each letter.}

type
LETTER = '0'..'z' ;
COUNTERS = array [LETTER] of INTEGER;
FLAGS = array [LETTER] of BOOLEAN;

var
LETCOUNT : COUNTERS;
LETFOUND : FLAGS;
NEXTCHAR : CHAR;

procedure CONCORD (var LETCOUNT {output} : COUNTERS;
var LETFOUND {OUTPUT} : FLAGS) ;

var
LINE : string[254];
I : 1..254;

begin {CONCORD}
WRITELN ( 'Type in a line of text.');
READLN ( LINE );
WRITELN ( LST, LINE );
for I := 1 to LENGTH ( LINE ) do
begin
if LINE [I] in ['0'.. 'z'] then
begin {LETTER}
LETCOUNT[LINE[I]] := LETCOUNT[LINE[I]] + 1;
LETFOUND[LINE[I]] := TRUE
end {LETTER}
end {for}
end; {CONCORD}

begin {CONCORDANCE}
for NEXTCHAR := '0' to 'z' do
begin
LETCOUNT[NEXTCHAR] := 0;
LETFOUND[NEXTCHAR] := FALSE
end; {for}
CONCORD (LETCOUNT, LETFOUND);
WRITELN (LST, 'LETTER', 'OCCURRENCES' :16);
for NEXTCHAR := '0' to 'z' do
if LETFOUND[NEXTCHAR] then
WRITELN (LST, NEXTCHAR :6, LETCOUNT[NEXTCHAR] :16)
end. {CONCORDANCE}





  3 Responses to “Category : Word Processors
Archive   : COUNTLTR.ZIP
Filename : CONCORDA.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/