
01.02.2011, 23:46
|
Прохожий
|
|
Регистрация: 19.12.2010
Сообщения: 17
Репутация: 12
|
|
помогите построить диаграмму
вот код.. производит подсчет количества повторений символов в тексте..
помогите сделать диаграмму по результатам подсчета
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
StringGrid1: TStringGrid;
OpenDialog1: TOpenDialog;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses unit2;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var I:integer;
begin
for i:=0 to 32 do
stringgrid1.Cells[0,i]:=(chr(i+224));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i,j:integer;
s:string;
begin
if opendialog1.Execute then
memo1.Lines.LoadFromFile(opendialog1.FileName);
s:=memo1.Text;
for j:=0 to 32 do
begin
for i:=1 to length(memo1.Text) do
if (s[i]=stringgrid1.Cells[0,j]) or (AnsiLowerCase(s[i])=stringgrid1.Cells[0,j]) then
if stringgrid1.Cells[1,j]='' then
stringgrid1.Cells[1,j]:='1' else
stringgrid1.Cells[1,j]:=inttostr(strtoint(stringgrid1.Cells[1,j])+1);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form2.Visible:=true;
end;
end.
|