Ребят, привет!
Срочно нужна помощь, программа запускается с ошибками, что только не делал, код уже убитый полностью.
unit1
Код:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Unit2;
type
TFilmi=class
private
FirstSeans:TFilmi;
Film:string;
public
constructor Create(aName:string);
function GetFirstSeans:TFilmi;
procedure AddSeans(anomSeans:string);
function DelSeans:boolean;
function FindSeans(anomSeans:string):TFilmi;
function GetAllSeansInf:string;
end;
implementation
procedure TFilmi.AddSeans(anomSeans:string);
begin
FirstSeans:=TFilmi.Create(anomSeans,FirstSeans);
end;
function TFilmi.DelSeans:boolean;
begin
FirstSeans:=FirstSeans.GetNext;
end;
function TFilmi.FindSeans(anomSeans:string):TSeans;
var CurrentAuto:TSeans;
begin
result:=nil;
CurrentSeans:=FirstSeans;
while (CurrentSeans<>nil) do
if (CurrentSeans.GetSeans=aSeans) then
begin result:=CurrentSeans; break; end
else CurrentSeans:=CurrentSeans.GetNext;
end;
unit2
Код:
unit Unit2;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type TSeans=class
private
nextSeans:TSeans; //
nomSeans:string;
Stoimost:array[1..8] of integer;
Price:integer;
public
constructor Create(anomSeans:string);
function GetnomSeans:string;
function GetPrice:integer;
function GetStoimost(nom:integer):integer;
function SetStoimost(nom, newPrice: integer):boolean;
function AddStoimost(newPrice:integer):boolean;
function SumPrice: real;
function GetData:string;
end;
implementation
constructor TSeans.Create(anomSeans:string);
begin
if anomSeans<>'' then
nomSeans:=anomSeans; Price:=0;
end;
function TSeans.GetPrice:integer;
begin result:=Price; end;
Function TSeans.GetnomSeans:string;
begin result:=nomSeans;
end;
function TSeans.GetStoimost(nom:integer):integer;
begin
if (nom>1) and (nom<Price) then
begin
if nom in [1..8] then
result:=Stoimost[nom];
end;
end;
function TSeans.SetStoimost(nom, newPrice: integer):boolean;
begin
if (nom>0) and (nom<=Price) and (newPrice in [0..50]) then
Stoimost[nom]:=newPrice ;
end;
function TSeans.AddStoimost(newPrice:integer):boolean;
begin
if (Price<7) and (newPrice in [0..50]) then
begin
Price:=Price+1;
Stoimost[Price]:=newPrice;
result:=true;
end
else
result:=false;
end;
function TSeans.SumPrice:real;
var
SumPrica,i:integer;
begin
SumPrice:=0;
for i:=1 to Price do
begin
SumPrice:=SumPrice+Stoimost[i];
end;
result:=SumPrice
end;
function TSeans.GetData:string;
var
i:integer;
begin
result:=nomSeans;
for i:=1 to Price do result:=result+' '+IntToStr(Stoimost[i]);
result:=result+' Сумма='+FloatToStr(SumPrice);
end;
end.
https://prnt.sc/solyyb