Создать класс chisla, заданный тремя целыми числами. Определить равны ли суммы их цифр,оформить в виде метода класса.
Код: Выделить всё
program р;
type Digit=class
x,y,z:real;
function sum:integer;
constructor create(xx,yy,zz:integer);
//Destructor Destroy;
end;
function Digit.sum:integer;
var s,m,n:integer;
begin
m:=abs(n);
s:=0;
while m>0 do
begin
s:=s+m mod 10;
m:=m div 10
end;
sum:=s;
end;
constructor Digit.create(xx,yy,zz:integer);
begin
if xx>0 then x:=xx;
if yy>0 then y:=yy;
if zz>0 then z:=zz;
end;
//destructor Dirit.destroy;