thienlakit96

Lak Nguyen

Đóng góp: 0

Ngày sinh: 18/10/1996

Đăng ký: 04/03/2016

Lần đăng nhập cuối: 04/03/2016


Kết nối tài khoản

VOJ: Chưa kết nối

[Gấp] Giúp e bài pascal về số phức với

Unit Ucomplex;
Interface
Type complex=record
                Thuc:real;
                Ao:Real;
             End;
{======================}
Procedure CreatComplex(a,b:real; var c:complex);
Function Getthuc(c:complex):Real;
Function Getao(c:complex):Real;
Function GetAbs(c:complex):Real;
Procedure Add(c1,c2:complex; var c:complex);
Procedure Multi(c1,c2:complex; var c:complex);
Procedure Print(c:complex);
{=======================}
Implementation
{=======================}
Procedure Creatcomplex(a,b:real; var c:complex);
Begin
     c.thuc:=a;
     c.ao:=b;
End;
{========================}
Function Getthuc(c:complex):real;
Begin
     getthuc:=c.thuc;
End;
{========================}
Function Getao(c:complex):real;
Begin
     Getao:= c.ao;
End;
{=========================}
Function GetAbs(c:complex):real;
Var result:real;
Begin
     Result:=sqrt(c.thuc*c.thuc+c.ao*c.ao);
     GetAbs:=result;
End;
{==========================}
Procedure Add(c1,c2:complex; Var c:complex);
Begin
     c.thuc:=c1.thuc+c2.thuc;
     c.ao:= c1.ao+c2.ao;
End;
{==========================}
Procedure Multi(c1,c2:complex; var c:complex);
Begin
     c.thuc:=(c1.thuc*c2.thuc)-(c1.ao*c2.ao);
     c.ao:=(c1.thuc*c2.ao)+(c1.ao*c2.thuc);
End;
{===========================}
Procedure Divi(c1,c2:complex; var c: complex);
Begin
     c.thuc:=(c1.thuc*c2.thuc+c1.ao*c2.ao)/(c2.thuc*c2.thuc+c2.ao*c2.ao);
     c.ao:=(c1.ao*c2.thuc-c1.thuc*c2.ao)/(c2.thuc*c2.thuc+c2.ao*c2.ao);
End;
{============================}
Procedure Print(c:complex);
Begin
     Writeln(c.thuc,'+',c.ao,'i');
End;
{============================}
End.

Cho Unit trên ạ. Viết chương trình chính tính,tổng, hiệu, tích thương số phức ợ. (Unit trên chưa hoàn chỉnh) Mọi người giúp e với :khoc: