unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, Buttons;
type
TForm1 = class(TForm)
Memo1: TMemo;
StringGrid1: TStringGrid;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var text:string;
i:integer;
counter:array[65..90] of integer;
begin
for i:= 65 to 90 do
counter[i]:=0;
text:=uppercase(memo1.Text);
for i:= 1 to length(text) do
counter[ord(text[i])]:=counter[ord(text[i])]+1;
for i:= 0 to 25 do begin
stringgrid1.Cells[i,0]:=chr(i+65);
stringgrid1.cells[i,1]:=inttostr(counter[i+65]);
end;
end;
end.