Category : Files from Magazines
Archive   : N7V11.ZIP
Filename : COMPLEX.PAS

 
Output of file : COMPLEX.PAS contained in archive : N7V11.ZIP
{$R-,S+,I+,D+,T-,F-,V+,B-,N-,L+ }
{$M 16384,0,655360 }
PROGRAM ComplexDemo;
TYPE
Complex = RECORD
L : byte; {dummy length byte}
R, I : Real; {real and imaginary parts}
END;
CompStr = STRING[12];
VAR
X : Compstr;
C1, C2, C3 : Complex;
N : Byte;

FUNCTION ComplexMul(A,B : Complex) : CompStr;
VAR Temp : Complex;
BEGIN
Temp.L := 12; {set the dummy length byte}
Temp.R := A.R*B.R - A.I*B.I;
Temp.I := A.R*B.I + A.I*B.R;
ComplexMul := CompStr(Temp); {typecast}
END;

BEGIN
C3 := Complex(X);
WriteLn('Enter 1st complex number, real part first. E.g. "2.5 5.0"');
Write(':'); ReadLn(C1.R, C1.I);
WriteLn('Enter 2nd complex number, real part first. E.g. "2.5 5.0"');
Write(':'); ReadLn(C2.R, C2.I);
CompStr(C3) := ComplexMul(C1,C2);{typecast}
WriteLn('Their product is ',C3.R:1:11,' + ',C3.I:1:11,'i');
END.

  3 Responses to “Category : Files from Magazines
Archive   : N7V11.ZIP
Filename : COMPLEX.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/