home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / interpre / p_pascal / samples / complex.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1990-04-02  |  766 b   |  23 lines

  1. {$c+,d+}
  2. program complex(output);
  3. { PROGRAM SUBMITTED BY MAKOTO YAMAGIWA. }
  4. const    tab = #9;
  5. type    complex = record re, im : integer end;
  6. var    x, y : complex;
  7. begin
  8.  writeln(tab,'Complex addition and multiplication; the first version');
  9.  writeln(tab,'of this program was submitted by Makoto Yamagiwa:');
  10.  writeln; writeln;
  11.  writeln('Fill in the requested information and type ''Enter'':');
  12.  writeln;
  13.  write(tab,'x.re = '); readln(x.re);
  14.  write(tab, 'x.im = '); readln(x.im);
  15.  write(tab,'y.re = '); readln(y.re);
  16.  write(tab, 'y.im = '); readln(y.im);
  17.  writeln; writeln;
  18.  writeln('sum = (', x.re + y.re : 1, ', ', x.im + y.im :1, ')');
  19.  writeln('product = (', x.re * y.re - x.im * y.im : 1, ', ',
  20.     x.re * y.im + x.im * y.re : 1, ')');
  21.  writeln
  22. end.
  23.