Do you receive the Programmer's Heaven newsletter? If not, why not subscribe?

View SAMPLES\COMPLEX.PAS

Portable ISO Standard Pascal in C, version 3.8

Submitted By: WEBMASTER
Rating: starstarstarstar (Rate It)


{$c+,d+}
program complex(output);
{ PROGRAM SUBMITTED BY MAKOTO YAMAGIWA. }
const   tab = #9;
type    complex = record re, im : integer end;
var     x, y : complex;
begin
 writeln(tab,'Complex addition and multiplication; the first version');
 writeln(tab,'of this program was submitted by Makoto Yamagiwa:');
 writeln; writeln;
 writeln('Fill in the requested information and type ''Enter'':');
 writeln;
 write(tab,'x.re = '); readln(x.re);
 write(tab, 'x.im = '); readln(x.im);
 write(tab,'y.re = '); readln(y.re);
 write(tab, 'y.im = '); readln(y.im);
 writeln; writeln;
 writeln('sum = (', x.re + y.re : 1, ', ', x.im + y.im :1, ')');
 writeln('product = (', x.re * y.re - x.im * y.im : 1, ', ',
        x.re * y.im + x.im * y.re : 1, ')');
 writeln
end.
 
corner
© 1996-2008. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin.
bootstrapLabs Logo A bootstrapLabs project.