Может всё-таки кто-нибудь поможет, вот моя прога создания списка, не судить строго =)
Как к ней приделать нахождение максимальных элементов списка. И как подсчитать число максим. элементов списка? Очень прошу помогите если не сложно!!!
Код
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Edit1: TEdit;
Button2: TButton;
procedure button1click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
PPoint=^elem;
elem=record
Info:Integer;
Next:PPoint;
end;
var
Form1: TForm1;
Start:PPoint=nil;
Finish:PPoint=nil;
implementation
{$R *.dfm}
procedure TForm1.button1click(Sender: TObject);
var NewPoint:PPoint;
begin
try
NewPoint:=nil;
NEW(NewPoint);
NewPoint.Info:=StrToInt(Edit1.Text);
NewPoint.Next:=nil;
if Start=nil then
Start:=NewPoint;
if Finish<>nil then
Finish.Next:=NewPoint;
Finish:=NewPoint;
Form1.ListBox1.Items.Add(IntToStr(NewPoint.Info));
except
if NewPoint<>nil then
Dispose(NewPoint);
end;
end;
end.