Модульное программирование в Турбо Паскале. Бакланов М.В - 7 стр.

UptoLike

Составители: 

- 7 -
Procedure
SubC;
begin
with z do
begin
re := x.re - y.re;
im := x.im – y.im
end
end;
Procedure MultC;
begin
z.re := x.re * y.re - x.im * y.im;
z.im := x.re * y.im +x. im * y.re
end;
Procedure DivC;
var
v: real;
begin
v := sqr(y.re) + sqr(y.im);
z.re := (x.re * y.re + x.im *y .im) / v;
z.im := (x.re * y.im - x.im * y.re) / v
end;
Function EqvC;
begin
EqvC := ( x.re = y.re ) and ( x.im = y.im )
end;
Procedure WriteC;
begin
with z do
begin
write (re);
if im=0 then exit;
if im>0 then write(’+’)
else write(’-’);
write(im)
end
end;
end . { mplx }
L_dklwlh]hfh^meyg_h[oh^bfhihf_klblv\nZce&PSO[SDV Ihke_lh]hdZd
hg [m^_l hldhfibebjh\Zg b kha^Zg khhl\_lk l\mxsbc738-nZce \uau\Zxs_c
ijh]jZff_klZgml ^hklmigu ijhp_^m ju bagh\hc[b[ebhl_db GZijbf_j \
ke_^mxs_cijh]jZff_ ijh\_jy_lky kh\iZ^Z_leb j_amevlZl Zjbnf_lbq_kdbo
                                       -7-

             Procedure SubC;
             begin
               with z do
               begin
                 re := x.re - y.re;
                 im := x.im – y.im
               end
             end;

             Procedure MultC;
             begin
               z.re := x.re * y.re - x.im * y.im;
               z.im := x.re * y.im +x. im * y.re
             end;

             Procedure DivC;
             var
               v: real;
             begin
               v := sqr(y.re) + sqr(y.im);
               z.re := (x.re * y.re + x.im *y .im) / v;
               z.im := (x.re * y.im - x.im * y.re) / v
             end;

             Function EqvC;
             begin
               EqvC := ( x.re = y.re ) and ( x.im = y.im )
             end;

             Procedure WriteC;
             begin
               with z do
               begin
                 write (re);
                 if im=0 then exit;
                 if im>0 then write(’+’)
                         else write(’-’);
                 write(im)
               end
             end;

           end .    { dhg_p fh^mey Kmplx }

      L_dklwlh]hfh^meyg_h[oh^bfhihf_klblv\nZce&PSO[SDV Ihke_lh]hdZd
hg [m^_l hldhfibebjh\Zg b kha^Zg khhl\_lkl\mxsbc 738-nZce \uau\Zxs_c
ijh]jZff_ klZgml ^hklmigu ijhp_^mju ba gh\hc [b[ebhl_db GZijbf_j \
ke_^mxs_c ijh]jZff_ ijh\_jy_lky kh\iZ^Z_l eb j_amevlZl Zjbnf_lbq_kdbo