Dieses Programm berechnet komplexe Zahlen (+,-,*,/):
[code:1]
var
Form1: TForm1;
rz1,rz2,iz1,iz2:integer;
implementation
{$R *.dfm}
procedure TForm1.btnstartClick(Sender: TObject);
begin
rz1:=strtoint(edtrz1.text);
rz2:=strtoint(edtrz2.text);
iz1:=strtoint(edtiz1.text);
iz2:=strtoint(edtiz2.text);
//______________SUMME______________________________________
edtsumme.Text:=inttostr(rz1+rz2)+'+'+inttostr(iz1+iz2)+'i';
//______________DIFFERENZ___________________________________
edtdifferenz.Text:=inttostr(rz1-rz2)+'+'+inttostr(iz1-iz2)+'i';
//______________Produkt___________________________________
edtprodukt.Text:=inttostr(rz1*rz2-iz1*iz2)+'+'+inttostr(rz1*iz2+iz1*rz2)+'i';
//______________Produkt___________________________________
edtprodukt.Text:=inttostr(rz1*rz2-iz1*iz2)+'+'+inttostr(rz1*iz2+iz1*rz2)+'i';
//______________QUOTIENT___________________________________
edtquotient.text:=floattostr(rz2/(rz2*rz2+iz2*iz2))+'-'+floattostr(iz2/(rz2*rz2+iz2*iz2))+'i';
end;
end.
[/code:1]
[code:1]
var
Form1: TForm1;
rz1,rz2,iz1,iz2:integer;
implementation
{$R *.dfm}
procedure TForm1.btnstartClick(Sender: TObject);
begin
rz1:=strtoint(edtrz1.text);
rz2:=strtoint(edtrz2.text);
iz1:=strtoint(edtiz1.text);
iz2:=strtoint(edtiz2.text);
//______________SUMME______________________________________
edtsumme.Text:=inttostr(rz1+rz2)+'+'+inttostr(iz1+iz2)+'i';
//______________DIFFERENZ___________________________________
edtdifferenz.Text:=inttostr(rz1-rz2)+'+'+inttostr(iz1-iz2)+'i';
//______________Produkt___________________________________
edtprodukt.Text:=inttostr(rz1*rz2-iz1*iz2)+'+'+inttostr(rz1*iz2+iz1*rz2)+'i';
//______________Produkt___________________________________
edtprodukt.Text:=inttostr(rz1*rz2-iz1*iz2)+'+'+inttostr(rz1*iz2+iz1*rz2)+'i';
//______________QUOTIENT___________________________________
edtquotient.text:=floattostr(rz2/(rz2*rz2+iz2*iz2))+'-'+floattostr(iz2/(rz2*rz2+iz2*iz2))+'i';
end;
end.
[/code:1]
mfg KC