Как компилировать dos-программы?
Например:
PROGRAM Pas;
{$M 20000,0,0}
USES DOS, CRT, MyCRT;
TYPE
T10x10Matrix=array[1..30,1..30] of real;
TArrStr=Array[1..30] of string;
VAR
f:text;
ch:char;
A,B,H,AV,AN:T10x10Matrix;
M,N,i1,i2,Lk,k,l:shortint;
AS,xV,xN,yV,yN,VSV,VSN,SN,SV,SABS,DV,DD,PO,DP,VP,SP,SS,US,USN:real;
Out,WhereEdit,si,sj:string;
CONST
ENTER=#13;ESC=#27;F1=#59;F4=#62;F9=#67;
{-------------------------------------------------------------------}
FUNCTiON Space(c:char;n:byte):string;
Var
i:byte;
s:string;
Begin
s:='';
For i:=1 to n do s:=s+c;
Space:=s
End;{Space}
PROCEDURE Editor(ss:string);
Begin
SwapVectors;
Exec(WhereEdit,ss);
SwapVectors
End;{Editor}
PROCEDURE ReadData;
Var
i,j,p:byte;
fn,f:text;
s:string;
code:integer;
Begin
Assign(f,'pr2003\wp.dat');
Reset(f);
ReadLn(f,s);
s:=s+' ';
For i:=1 to 5 do
begin
p:=Pos(' ',s);
Case i of
1:Val(Copy(s,1,p-1),M,code);
2:Val(Copy(s,1,p-1),N,code);
3:Val(Copy(s,1,p-1),i1,code);
4:Val(Copy(s,1,p-1),i2,code);
5:Val(Copy(s,1,p-1),LK,code)
end;
Delete(s,1,p);
end;
For i:=1 to M do
begin
ReadLn(f,s);
s:=s+' ';
For j:=1 to N do
begin
p:=Pos(' ',s);
Val(Copy(s,1,p-1),A[i,j],code);
Delete (s,1,p)
end
end;
Close(f)
End;{ReadData}
PROCEDURE Count;
Var
i,j:byte;
Begin
AS:=0.0;
For i:=1 to (M-1) do For j:=1 to (N-1) do
AS:=AS+(A[i,j]+A[i+1,j]+A[i,j+1]+A[i+1,j+1])/(4.0*(M-1)*(N-1));
For i:=1 to M do For j:=1 to N do
begin
B[i,j]:=AS-(2*j-N-1)*i1*Lk/2000+(2*i-M-1)*i2*Lk/2000;
H[i,j]:=B[i,j]-A[i,j];
end;
xV:= 0; xN:= 0; yV:= 0; yN:= 0; VSV:= 0; VSN:= 0;
For i:=1 to (M-1) do For j:=1 to (N-1) do
begin
SN:= 0; SV:= 0; SABS:= 0;
For k:=1 to 2 do For l:=1 to 2 do
begin
SABS:=SABS+Abs(H[i+k-1,j+l-1]);
if (H[i+k-1,j+l-1])<0 then SV:=SV+H[i+k-1,j+l-1]
else SN:=SN+H[i+k-1,j+l-1];
end;
AV[i,j]:=-sqr(Lk*SV)/(4.0*SABS);
AN[i,j]:=sqr(Lk*SN)/(4.0*SABS);
xV:=xV-AV[i,j]*(i);
xN:=xN+AN[i,j]*(i);
yV:=yV-AV[i,j]*(j);
yN:=yN+AN[i,j]*(j);
VSV:=VSV+sqr(Lk)*sqr(SV)/(4.0*SABS);
VSN:=VSN+sqr(Lk)*sqr(SN)/(4.0*SABS);
end;
DV:=VSV-VSN;
DD:=sqrt(sqr((xV/VSV-xN/VSN)*Lk)+sqr((yV/VSV-yN/VSN)*Lk));
PO:=(M-1)*(N-1)*Lk*Lk;
DP:=DD/2.0;
VP:=PO*0.2;
SV:=VSV*(262.9+((DD-10.0)/10.0)*213.4);
SP:=VP*(262.9+((DD-10.0)/10.0)*213.4);
SS:=SP+SV;
End;
PROCEDURE OutPut1;
Var
i,j:byte;
s,sA,sB,sH:string;
Begin
If Out='PRN' then
begin
Assign(f,'pr2003\wp.res');rewrite(f);
WriteLn(f,' Џ‹ЂЌ ЋђѓЂЌ€‡Ђ–€€ ђ…‹њ…”Ђ');
WriteLn(f,'')
end;
If Out='CON' then
begin
WriteLn(' Џ‹ЂЌ ЋђѓЂЌ€‡Ђ–€€ ђ…‹њ…”Ђ');
WriteLn('')
end;
For i:=1 to M do
begin
s:=Space(' ',5);
For j:=1 to N do
begin
Str(H[i,j]:7:2,sH);
s:=s+sH+' ';
Str(B[i,j]:1:2,sB);
Repeat sB:=sB+' ' until Length(sB)=7;
s:=s+sB
end;
If Out='PRN' then WriteLn(f,s);
If Out='CON' then WriteLn(s);
s:=Space(' ',12);
For j:=1 to N do s:=s+'*'+Space(' ',14);
If Out='PRN' then WriteLn(f,s);
If Out='CON' then WriteLn(s);
s:=Space(' ',13);
For j:=1 to N do
begin
Str(A[i,j]:1:2,sA);
Repeat sA:=sA+' ' until Length(sA)=15;
s:=s+sA
end;
If Out='PRN' then
begin
WriteLn(f,s);
WriteLn(f,'');
WriteLn(f,'');
end;
If Out='CON' then
begin
WriteLn(s);
WriteLn('');
WriteLn('')
end; end;
If Out='PRN' then WriteLn('Њ®¦ҐвҐ Ї®б¬®ваҐвм १г«мв вл ў б®еа Ґ®¬ д ©«Ґ - ¦¬ЁвҐ ENTER');
If Out='CON' then WriteLn('„«п Їа®¤®«¦ҐЁп ¦¬ЁвҐ ENTER');
Repeat ch:=Key until ch=ENTER;
End;{OutPut1}
PROCEDURE OutPut2;
Var
i,j:byte;
c1,c2,c3:char;
sAN:TArrStr;
s,sr:string;
Procedure MakeString(c1,c2,c3:char;sd:TArrStr);
var
j:byte;
begin
s:=c1;
For j:=1 to N-1 do
If j<N-1 then s:=s+sd[j]+c2 else s:=s+sd[j];
s:=s+c3;
If Out='PRN' then WriteLn(f,s);
If Out='CON' then WriteLn(s);
end;
Begin
ClrScr;
If Out='PRN' then
begin
WriteLn(f,' Џ‹ЂЌ ‡…Њ‹џЌ›• ЊЂ‘‘');
WriteLn(f,'')
end;
If Out='CON' then
begin
WriteLn(' Џ‹ЂЌ ‡…Њ‹џЌ›• ЊЂ‘‘');
WriteLn('')
end;
For i:=1 to M-1 do
begin
If i=1 then
begin
c1:='Ъ';
c2:='В';
c3:='ї'
end
else
begin
c1:='Г';
c2:='Е';
c3:='ґ'
end;
For j:=1 to N-1 do sAN[j]:=Space('Д',10);
MakeString(c1,c2,c3,sAN);
For j:=1 to N-1 do sAN[j]:=Space(' ',10);
MakeString('і','і','і',sAN);
For j:=1 to N-1 do
begin
Str(AN[i,j]:7:0,sAN[j]);
sAN[j]:=sAN[j]+Space(' ',3)
end;
MakeString('і','і','і',sAN);
For j:=1 to N-1 do
begin
Str(AV[i,j]:7:0,sAN[j]);
sAN[j]:=sAN[j]+Space(' ',3)
end;
MakeString('і','і','і',sAN);
For j:=1 to N-1 do sAN[j]:=Space(' ',10);
MakeString('і','і','і',sAN);
end;
For j:=1 to N-1 do sAN[j]:=Space('Д',10);
MakeString('А','Б','Щ',sAN);
If Out='CON' then BEGIN
writeln('Ћ ‘ Ќ Ћ ‚ Ќ › … Џ Ћ Љ Ђ ‡ Ђ ’ … ‹ € Џ ђ Ћ … Љ ’ Ђ');
writeln('ЋЃ™Ђџ Џ‹Ћ™Ђ„њ “—Ђ‘’ЉЂ Џ‹ЂЌ€ђЋ‚Љ€',PO:7:0,' ¬2');
writeln('ЏђЋ…Љ’Ќ›… “Љ‹ЋЌ›:ЏђЋ„Ћ‹њЌ›‰ - ',I1:7,'(ў Їа®¬Ё««пе)');
writeln(' ЏЋЏ…ђ…—Ќ›‰ - ',I2:7,'(ў Їа®¬Ё««пе)');
writeln('„‹€ЌЂ ‘’ЋђЋЌ› Љ‚Ђ„ђЂ’Ђ - ',Lk:7,' ¬');
writeln('Ћ Ѓ љ р Њ ‚ › … Њ Љ € - ',VSV:7:0,' ¬2');
writeln('Ћ Ѓ љ р Њ Ќ Ђ ‘ › Џ € - ',VSN:7:0,' ¬2');
writeln('‘ђ…„Ќ…‚‡‚……ЌЌЋ… ђЂ‘‘’ЋџЌ€… Џ…ђ…Њ…™…Ќ€џ ѓђ“Ќ’Ђ -',DD:7:0,' ¬');
writeln('„Ђ‹њЌЋ‘’њ Џ…ђ…Њ…™…Ќ€џ Џ‹Ћ„ЋђЋ„ЌЋѓЋ ѓђ“Ќ’Ђ -',DP:7:0,' ¬');
writeln('‘’Ћ€ЊЋ‘’њ Џ…ђ…Њ…™…Ќ€џ Џ‹Ћ„ЋђЋ„ЌЋѓЋ ѓђ“Ќ’Ђ -',SP:7:0,' агЎ');
writeln('‘’Ћ€ЊЋ‘’њ Џ…ђ…Њ…™…Ќ€џ ѓђ“Ќ’Ђ ‚›…ЊЋЉ ‚ ЌЂ‘›Џ€ -',SV:7:0,' агЎ');
writeln('ЋЃ™Ђџ ‘Њ…’ЌЂџ ‘’Ћ€ЊЋ‘’њ ‚›ЏЋ‹Ќ…Ќ€џ ‡…Њ‹џЌ›• ђЂЃЋ’');
writeln('Ѓ“‹њ„Ћ‡…ђЋЊ „‡-17 ЊЋ™ЌЋ‘’њћ 96 Є‚в -',SS:7:0,' агЎ');
END;
begin
WriteLn('„«п § ўҐаиҐЁп Їа®Ја ¬¬л ¦¬ЁвҐ ENTER');
Repeat ch:=Key until ch=ENTER
end;
if Out='PRN' then
begin
writeln(f,'Ћ ‘ Ќ Ћ ‚ Ќ › … Џ Ћ Љ Ђ ‡ Ђ ’ … ‹ € Џ ђ Ћ … Љ ’ Ђ');
writeln(f,'ЋЃ™Ђџ Џ‹Ћ™Ђ„њ “—Ђ‘’ЉЂ Џ‹ЂЌ€ђЋ‚Љ€',PO:7:0,' ¬2');
writeln(f,'ЏђЋ…Љ’Ќ›… “Љ‹ЋЌ›:ЏђЋ„Ћ‹њЌ›‰ - ',I1:7,'(‚ Їа®¬Ё««пе)');
writeln(f,' ЏЋЏ…ђ…—Ќ›‰ - ',I2:7,'(‚ Їа®¬Ё««пе)');
writeln(f,'„‹€ЌЂ ‘’ЋђЋЌ› Љ‚Ђ„ђЂ’Ђ - ',Lk:7,' ¬');
writeln(f,'Ћ Ѓ љ р Њ ‚ › … Њ Љ € - ',VSV:7:0,' ¬2');
writeln(f,'Ћ Ѓ љ р Њ Ќ Ђ ‘ › Џ € - ',VSN:7:0,' ¬2');
writeln(f,'‘ђ…„Ќ…‚‡‚……ЌЌЋ… ђЂ‘‘’ЋџЌ€… Џ…ђ…Њ…™…Ќ€џ ѓђ“Ќ’Ђ -',DD:7:0,' ¬');
writeln(f,'„Ђ‹њЌЋ‘’њ Џ…ђ…Њ…™…Ќ€џ Џ‹Ћ„ЋђЋ„ЌЋѓЋ ѓђ“Ќ’Ђ -',DP:7:0,' ¬');
writeln(f,'‘’Ћ€ЊЋ‘’њ Џ…ђ…Њ…™…Ќ€џ Џ‹Ћ„ЋђЋ„ЌЋѓЋ ѓђ“Ќ’Ђ -',SP:7:0,' агЎ');
writeln(f,'‘’Ћ€ЊЋ‘’њ Џ…ђ…Њ…™…Ќ€џ ѓђ“Ќ’Ђ ‚›…ЊЋЉ ‚ ЌЂ‘›Џ€ -',SV:7:0,' агЎ');
writeln(f,'ЋЃ™Ђџ ‘Њ…’ЌЂџ ‘’Ћ€ЊЋ‘’њ ‚›ЏЋ‹Ќ…Ќ€џ ‡…Њ‹џЌ›• ђЂЃЋ’');
writeln(f,'Ѓ“‹њ„Ћ‡…ђЋЊ „‡-17 ЊЋ™ЌЋ‘’њћ 96 Є‚в -',SS:7:0,' агЎ');
close(f);
End;
End;
PROCEDURE OutPut;
Begin
ClrScr;
WriteLn('„«п ўлў®¤ १г«мв в®ў нЄа ¦¬ЁвҐ F1');
WriteLn('„«п б®еа ҐЁп १г«мв в®ў ў д ©«Ґ ¦¬ЁвҐ F9');
Repeat ch:=Key until ch in [F1,F9];
ClrScr;
Case ch of
F1:Out:='CON';
F9:Out:='PRN'
end;
OutPut1;
OutPut2
End;
BEGiN
ClrScr;
ReadData;
Count;
OutPut
END.