Help" converting code Pascal - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help" converting code Pascal

thocamthocam Posts: 2Member
I have code pascal, but I want to chang to another programming VB, Delphi, C++ (program run on Windows ), please help me.

[email protected]

Comments

  • zibadianzibadian Posts: 6,349Member
    : I have code pascal, but I want to chang to another programming VB, Delphi, C++ (program run on Windows ), please help me.
    :
    : [email protected]
    :
    Delphi is the most logical choice, because Delphi is very similar. A lot of text-based Pascal programs can also be compiled in Delphi without much changing.
  • thocamthocam Posts: 2Member
    very happy if you can help. Really, I do not know much about pascal, so if I change this code to Delphi, can I change the interface of program so it similar lisk on windows .


    Below is a part of code Pascal. Can you change as a example

    Thanks very much for your help

    Ngam K = 0
    Khop K = E+10
    Kha nang : 80 nut, 80 phan tu, 50 d/k bien


    HWRU 2000
    { *************************************************************************** }
    PROGRAM K3;
    Uses Dos,Crt;
    Const
    Ncn=2; Ndf=3;
    Var
    Nop : Array[1..80,1..Ncn] Of Integer;
    Imt : Array[1..80] Of Integer;
    Ibc,Nfix : Array[1..50] Of Integer;
    Mt : Array[1..80,1..3] Of Real;
    Cord : Array[1..80,1..2] Of Real;
    SK : Array[1..240,1..30] Of Real;
    R1 : Array[1..240] Of Real;
    ki1,ki2 : Array[1..80] Of Real;
    Li1,Li2 : Array[1..80] Of Real;
    EK,BD : Array[1..6,1..6] Of Real;
    AL,CC,SS : Array[1..80] Of Real;
    k11 : Byte;
    f1,f2 : Text;
    Tenfile : String[30];
    Ne,Np,Nb,Nl,Nmt,Nroe,Mband,i,j,k,l,m,n,IC : Integer;
    {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    PROCEDURE DOC_SO_LIEU;
    Var
    R2 : Array[1..3] of Real;
    DX,DY : Real;
    Begin
    {
    Write('Ten file so lieu : '); Readln(Tenfile);
    {}
    Tenfile:='VIDU11.DAT';
    Assign(f1,Tenfile); Reset(f1);
    {
    Write('Ten file ket qua : '); Readln(Tenfile);
    {}
    Tenfile:='VIDU11.TXT';
    Assign(f2,Tenfile); ReWrite(f2);
    Readln(f1,NP,NE,NB,NL,Nmt);
    Writeln(f2,'':8,'+ So nut.....................................: ':47,NP:4);
    Writeln(f2,'':8,'+ So luong phan tu ..........................: ':47,NE:4);
    Writeln(f2,'':8,'+ So nut co lien ket.........................: ':47,NB:4);
    Writeln(f2,'':8,'+ So nut co luc tap trung....................: ':47,NL:4);
    Writeln(f2,'':8,'+ So loai vat lieu...........................: ':47,Nmt:4);
    Writeln(f2,'':8,'+ Nut X Y ');
    Nroe:=NP*3;
    For i:=1 To NP Do
    Begin
    Readln(f1,n,Cord[n,1],Cord[n,2]);
    Writeln(f2,'':7,n:4,Cord[n,1]:14:5,Cord[n,2]:14:5);
    End;
    Writeln(f2,'':8,'+ Ten nut Luc Px Luc Py Momen');
    For i:=1 To Nroe Do R1[i]:=0;
    For i:=1 To NL Do
    Begin
    Readln(f1,n,R2[1],R2[2],R2[3]);
    Writeln(f2,'':8,n:4,R2[1]:12:5,R2[2]:12:5,R2[3]:12:5);
    For k:=1 To 3 Do
    Begin
    IC:=(n-1)*3+k;
    R1[IC]:=R1[IC]+R2[K];
    End;
    End;
    Writeln(f2,'':8,'+ LoaiV.L E F J ');
    For i:=1 To Nmt Do
    Begin
    Readln(f1,n,Mt[n,1],Mt[n,2],Mt[n,3]);
    Writeln(f2,'':8,n:4,'':5,Mt[n,1]:12,'':5,Mt[n,2]:12,'':5,Mt[n,3]:12);
    End;
    Writeln(f2,'':8,'+ Phan_tu ki1 Li1 ki2 Li2 Nut I Nut J LoaiV.L');
    For i:=1 To NE Do
    Begin
    Readln(f1,n,ki1[n],Li1[n],ki2[n],Li2[n],Nop[n,1],Nop[n,2],Imt[n]);
    Write(f2,'':8,n:6,ki1[n]:6,Li1[n]:6,ki2[n]:6,Li2[n]:6);
    Writeln(f2,Nop[n,1]:8,Nop[n,2]:8,Imt[n]:10);
    End;
    Writeln(f2,'':8,'+ Ten nut co lien ket Ma lien ket');
    For i:=1 To NB Do
    Begin
    Readln(f1,Ibc[i],Nfix[i]);
    Writeln(f2,'':8,Ibc[i]:4,Nfix[i]:26);
    End;
    For i:=1 To NE Do
    Begin
    l:=Nop[i,1];
    m:=Nop[i,2];
    DX:=Cord[m,1]-Cord[l,1];
    DY:=Cord[m,2]-Cord[l,2];
    AL[i]:=SQRT(DX*DX+DY*DY);
    CC[i]:=DX/AL[i];
    SS[i]:=DY/AL[i];
    End;
    End;
    {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    PROCEDURE CUNG(n:Byte);
    Var
    a,aLe : Array[1..6,1..6] Of Real;
    i2,j2,k2 : Integer;
    Ee,Fe,Je,ci,MS : Real;
    Phi,muy,Ge : Real;
    Length : Real;
    Begin
    For i2:=1 To 6 Do
    For j2:=1 To 6 Do
    Begin
    EK[i2,j2]:=0;
    a[i2,j2]:=0;
    aLe[i2,j2]:=0;
    End;
    Ee:=Mt[Imt[n],1]; Fe:=Mt[Imt[n],2]; Je:=Mt[Imt[n],3];

    muy:=0.2;
    { Ge:=Ee/2/(1+muy); }
    Ge:=1.0546e+19;

    Length:=AL[n]-Li1[n]-Li2[n];
    Phi:=(3*muy*Ee*Je)/(Length*Length*Ge*Fe);

    { Ma tran cosin chi phuong }
    a[1,1]:=CC[n]; a[1,2]:=SS[n]; a[2,1]:=-SS[n]; a[2,2]:=CC[n];
    a[3,3]:=1; a[4,4]:=CC[n]; a[4,5]:=SS[n]; a[5,4]:=-SS[n];
    a[5,5]:=CC[n]; a[6,6]:=1;

    { Ma tran nut cung hai dau }
    aLe[1,1]:=1; aLe[2,2]:=1; aLe[2,3]:=-Li1[n]; aLe[3,3]:=1;
    aLe[4,4]:=1; aLe[5,5]:=1; aLe[5,6]:=Li2[n]; aLe[6,6]:=1;

    { Do cung phan tu co lien ket mem }
    ci:=Ee*Je/Length;
    MS:=(4*(1+3*ki1[n]*ci+Phi)*(1+3*ki2[n]*ci+Phi)-(1-2*Phi)*(1-2*Phi));
    MS:=Length*Length*MS;

    EK[1,1]:=Ee*Fe/Length;
    EK[1,4]:=-Ee*Fe/Length;
    EK[2,2]:=36*ci*(1+(ki1[n]+ki2[n])*ci)/MS;
    EK[2,3]:=-18*ci*(1+2*ki2[n]*ci)*Length/MS;
    EK[2,5]:=-EK[2,2];
    EK[2,6]:=-18*ci*(1+2*ki1[n]*ci)*Length/MS;
    EK[3,3]:=12*ci*(1+3*ki2[n]*ci+Phi)*Length*Length/MS;
    EK[3,5]:=-EK[2,3];
    EK[3,6]:=6*ci*(1-2*Phi)*Length*Length/MS;
    EK[4,4]:=EK[1,1];
    EK[5,5]:=EK[2,2];
    EK[5,6]:=-EK[2,6];
    EK[6,6]:=12*ci*(1+3*ki1[n]*ci+Phi)*Length*Length/MS;

    For i2:=1 To 6 Do
    For j2:=i2 To 6 Do EK[j2,i2]:=EK[i2,j2];

    { Do cung phan tu co lien ket mem va nut cung }
    For i2:=1 To 6 Do
    For j2:=1 To 6 Do
    Begin
    BD[i2,j2]:=0;
    For k2:=1 To 6 Do BD[i2,j2]:=BD[i2,j2]+EK[i2,k2]*aLe[k2,j2];
    End;
    For i2:=1 To 6 Do
    For j2:=1 To 6 Do
    Begin
    EK[i2,j2]:=0;
    For k2:=1 To 6 Do EK[i2,j2]:=EK[i2,j2]+BD[k2,j2]*aLe[k2,i2];
    End;

    { Dua ve ma tran do cung he thong }
    For i2:=1 To 6 Do
    For j2:=1 To 6 Do
    Begin
    BD[i2,j2]:=0;
    For k2:=1 To 6 Do BD[i2,j2]:=BD[i2,j2]+EK[i2,k2]*a[k2,j2];
    End;
    If k11=1 Then
    Begin
    For i2:=1 To 6 Do
    For j2:=1 To 6 do
    Begin
    EK[i2,j2]:=0;
    For k2:=1 To 6 Do EK[i2,j2]:=EK[i2,j2]+BD[k2,j2]*a[k2,i2];
    End;
    End;
    End;
    {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    PROCEDURE DO_CUNG;
    Var
    j3,k3,Nrowb,Ncolb,Ncol,n1,IC,Nx:Integer;
    Begin
    Mband:=0;
    For n:=1 To NE Do
    Begin
    i:=Nop[n,1]; j:=Nop[n,2];
    If Mband0 Then SK[Nrowb,Ncol]:=SK[Nrowb,Ncol]+EK[i,l];
    End;
    End;
    End;
    End;
    End;
    For n:=1 To NB Do
    Begin
    Nx:=1;
    For k:=1 To Ndf-1 Do Nx:=Nx*10;
    i:=Ibc[n];
    Nrowb:=(i-1)*Ndf;
    For m:=1 To Ndf Do
    Begin
    Nrowb:=Nrowb+1;
    IC:=Trunc(Nfix[n]/Nx);
    If IC>0 Then
    Begin
    SK[Nrowb,1]:=1;
    For j:=2 To Mband Do
    Begin
    SK[Nrowb,j]:=0;
    n1:=Nrowb+1-j;
    If n1>0 Then SK[n1,j]:=0;
    End;
    Nfix[n]:=Nfix[n]-Nx*IC;
    Nx:=Trunc(Nx/10);
    End
    Else Nx:=Trunc(Nx/10);
    End;
    End;
    End;
    {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    PROCEDURE GIAI_HE_PHUONG_TRINH;
    Var
    C:Real;
    Begin
    For n:=1 To Nroe Do
    Begin
    i:=n;
    For l:=2 To Mband Do
    Begin
    i:=i+1;
    If SK[n,l]<>0 Then
    Begin
    C:=SK[n,l]/SK[n,1];
    j:=0;
    For k:=L To Mband Do
    Begin
    j:=j+1;
    If SK[n,k]<>0 Then SK[i,j]:=Sk[i,j]-C*SK[n,k];
    End;
    SK[n,L]:=C;
    R1[i]:=R1[i]-C*R1[n];
    End;
    End;
    If SK[N,1]=0 Then SK[N,1]:=1E-15;
    R1[n]:=R1[n]/SK[n,1];
    End;
    n:=Nroe;
    Repeat
    n:=n-1;
    L:=n;
    For k:=2 To Mband Do
    Begin
    L:=L+1;
    If SK[n,k]<>0 Then R1[n]:=R1[n]-SK[n,k]*R1[L];
    End;
    Until n=1;
    End;
    {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    PROCEDURE NOI_LUC;
    Var
    DIS :Array[1..Ndf,1..30] Of Real;
    Force :Array[1..80,1..6] Of Real;
    R :Array[1..6] Of Real;
    ij,ia :Integer;
    Begin
    For i:=1 To NP Do
    Begin
    Dis[1,i]:=R1[Ndf*i-2];
    Dis[2,i]:=R1[Ndf*i-1];
    Dis[3,i]:=R1[Ndf*i]
    End;
    For i:=1 To NE Do
    For j:=1 To 6 Do Force[i,j]:=0;
    For N:=1 To NE Do
    Begin
    k11:=0;
    CUNG(n);
    For i:=1 To Ncn Do
    Begin
    m:=Nop[n,i];
    k:=(i-1)*Ndf;
    For j:=1 To Ndf Do
    Begin
    ij:=j+k;
    R[ij]:=DIS[j,m];
    End;
    End;
    For i:=1 To 6 Do
    For j:=1 To 6 Do Force[N,i]:=Force[N,i]+BD[i,j]*R[j];
    End;
    Writeln(f2);
    Writeln(f2,'':5,' K E T Q U A C H U Y E N V I');
    Writeln(f2);
    Writeln(f2,'':13,' Nut Ux Uy Goc');
    Writeln(f2);
    For m:=1 To NP Do
    Writeln(f2,'':13,m:3,'':5,Dis[1,m]:10,'':5,Dis[2,m]:10,'':5,
    Dis[3,m]:10);
    Writeln(f2);
    Writeln(f2,'':4,' K E T Q U A N O I L U C ');
    Writeln(f2);
    Writeln(f2,'':13,'Phan tu Luc Doc Luc Cat Momen ');
    Writeln(f2);
    For N:=1 To Ne Do
    Begin
    Writeln(f2,'':13,n:3,'',Force[N,1]:16:6,Force[n,2]:16:6,Force[N,3]:16:6);
    Writeln(f2,'':16,Force[N,4]:16:6,Force[N,5]:16:6,Force[N,6]:16:6);
    End;
    Close(f2);
    Writeln;
    {
    Writeln('':9,'Ket qua da duoc ghi vao file :.................. ',Tenfile);
    Write('':9,'An ENTER de thoat khoi chuong trinh ............',#7);
    Readln;
    {}
    Clrscr;
    End;
    {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    BEGIN
    ClrScr;
    DOC_SO_LIEU;
    DO_CUNG;
    GIAI_HE_PHUONG_TRINH;
    NOI_LUC;
    END.
    {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}

  • zibadianzibadian Posts: 6,349Member
    : very happy if you can help. Really, I do not know much about pascal, so if I change this code to Delphi, can I change the interface of program so it similar lisk on windows .
    :
    :
    : Below is a part of code Pascal. Can you change as a example
    :
    : Thanks very much for your help
    :
    : Ngam K = 0
    : Khop K = E+10
    : Kha nang : 80 nut, 80 phan tu, 50 d/k bien
    :
    :
    : HWRU 2000
    : { *************************************************************************** }
    : PROGRAM K3;
    : Uses Dos,Crt;
    : Const
    : Ncn=2; Ndf=3;
    : Var
    : Nop : Array[1..80,1..Ncn] Of Integer;
    : Imt : Array[1..80] Of Integer;
    : Ibc,Nfix : Array[1..50] Of Integer;
    : Mt : Array[1..80,1..3] Of Real;
    : Cord : Array[1..80,1..2] Of Real;
    : SK : Array[1..240,1..30] Of Real;
    : R1 : Array[1..240] Of Real;
    : ki1,ki2 : Array[1..80] Of Real;
    : Li1,Li2 : Array[1..80] Of Real;
    : EK,BD : Array[1..6,1..6] Of Real;
    : AL,CC,SS : Array[1..80] Of Real;
    : k11 : Byte;
    : f1,f2 : Text;
    : Tenfile : String[30];
    : Ne,Np,Nb,Nl,Nmt,Nroe,Mband,i,j,k,l,m,n,IC : Integer;
    : {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    : PROCEDURE DOC_SO_LIEU;
    : Var
    : R2 : Array[1..3] of Real;
    : DX,DY : Real;
    : Begin
    : {
    : Write('Ten file so lieu : '); Readln(Tenfile);
    : {}
    : Tenfile:='VIDU11.DAT';
    : Assign(f1,Tenfile); Reset(f1);
    : {
    : Write('Ten file ket qua : '); Readln(Tenfile);
    : {}
    : Tenfile:='VIDU11.TXT';
    : Assign(f2,Tenfile); ReWrite(f2);
    : Readln(f1,NP,NE,NB,NL,Nmt);
    : Writeln(f2,'':8,'+ So nut.....................................: ':47,NP:4);
    : Writeln(f2,'':8,'+ So luong phan tu ..........................: ':47,NE:4);
    : Writeln(f2,'':8,'+ So nut co lien ket.........................: ':47,NB:4);
    : Writeln(f2,'':8,'+ So nut co luc tap trung....................: ':47,NL:4);
    : Writeln(f2,'':8,'+ So loai vat lieu...........................: ':47,Nmt:4);
    : Writeln(f2,'':8,'+ Nut X Y ');
    : Nroe:=NP*3;
    : For i:=1 To NP Do
    : Begin
    : Readln(f1,n,Cord[n,1],Cord[n,2]);
    : Writeln(f2,'':7,n:4,Cord[n,1]:14:5,Cord[n,2]:14:5);
    : End;
    : Writeln(f2,'':8,'+ Ten nut Luc Px Luc Py Momen');
    : For i:=1 To Nroe Do R1[i]:=0;
    : For i:=1 To NL Do
    : Begin
    : Readln(f1,n,R2[1],R2[2],R2[3]);
    : Writeln(f2,'':8,n:4,R2[1]:12:5,R2[2]:12:5,R2[3]:12:5);
    : For k:=1 To 3 Do
    : Begin
    : IC:=(n-1)*3+k;
    : R1[IC]:=R1[IC]+R2[K];
    : End;
    : End;
    : Writeln(f2,'':8,'+ LoaiV.L E F J ');
    : For i:=1 To Nmt Do
    : Begin
    : Readln(f1,n,Mt[n,1],Mt[n,2],Mt[n,3]);
    : Writeln(f2,'':8,n:4,'':5,Mt[n,1]:12,'':5,Mt[n,2]:12,'':5,Mt[n,3]:12);
    : End;
    : Writeln(f2,'':8,'+ Phan_tu ki1 Li1 ki2 Li2 Nut I Nut J LoaiV.L');
    : For i:=1 To NE Do
    : Begin
    : Readln(f1,n,ki1[n],Li1[n],ki2[n],Li2[n],Nop[n,1],Nop[n,2],Imt[n]);
    : Write(f2,'':8,n:6,ki1[n]:6,Li1[n]:6,ki2[n]:6,Li2[n]:6);
    : Writeln(f2,Nop[n,1]:8,Nop[n,2]:8,Imt[n]:10);
    : End;
    : Writeln(f2,'':8,'+ Ten nut co lien ket Ma lien ket');
    : For i:=1 To NB Do
    : Begin
    : Readln(f1,Ibc[i],Nfix[i]);
    : Writeln(f2,'':8,Ibc[i]:4,Nfix[i]:26);
    : End;
    : For i:=1 To NE Do
    : Begin
    : l:=Nop[i,1];
    : m:=Nop[i,2];
    : DX:=Cord[m,1]-Cord[l,1];
    : DY:=Cord[m,2]-Cord[l,2];
    : AL[i]:=SQRT(DX*DX+DY*DY);
    : CC[i]:=DX/AL[i];
    : SS[i]:=DY/AL[i];
    : End;
    : End;
    : {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    : PROCEDURE CUNG(n:Byte);
    : Var
    : a,aLe : Array[1..6,1..6] Of Real;
    : i2,j2,k2 : Integer;
    : Ee,Fe,Je,ci,MS : Real;
    : Phi,muy,Ge : Real;
    : Length : Real;
    : Begin
    : For i2:=1 To 6 Do
    : For j2:=1 To 6 Do
    : Begin
    : EK[i2,j2]:=0;
    : a[i2,j2]:=0;
    : aLe[i2,j2]:=0;
    : End;
    : Ee:=Mt[Imt[n],1]; Fe:=Mt[Imt[n],2]; Je:=Mt[Imt[n],3];
    :
    : muy:=0.2;
    : { Ge:=Ee/2/(1+muy); }
    : Ge:=1.0546e+19;
    :
    : Length:=AL[n]-Li1[n]-Li2[n];
    : Phi:=(3*muy*Ee*Je)/(Length*Length*Ge*Fe);
    :
    : { Ma tran cosin chi phuong }
    : a[1,1]:=CC[n]; a[1,2]:=SS[n]; a[2,1]:=-SS[n]; a[2,2]:=CC[n];
    : a[3,3]:=1; a[4,4]:=CC[n]; a[4,5]:=SS[n]; a[5,4]:=-SS[n];
    : a[5,5]:=CC[n]; a[6,6]:=1;
    :
    : { Ma tran nut cung hai dau }
    : aLe[1,1]:=1; aLe[2,2]:=1; aLe[2,3]:=-Li1[n]; aLe[3,3]:=1;
    : aLe[4,4]:=1; aLe[5,5]:=1; aLe[5,6]:=Li2[n]; aLe[6,6]:=1;
    :
    : { Do cung phan tu co lien ket mem }
    : ci:=Ee*Je/Length;
    : MS:=(4*(1+3*ki1[n]*ci+Phi)*(1+3*ki2[n]*ci+Phi)-(1-2*Phi)*(1-2*Phi));
    : MS:=Length*Length*MS;
    :
    : EK[1,1]:=Ee*Fe/Length;
    : EK[1,4]:=-Ee*Fe/Length;
    : EK[2,2]:=36*ci*(1+(ki1[n]+ki2[n])*ci)/MS;
    : EK[2,3]:=-18*ci*(1+2*ki2[n]*ci)*Length/MS;
    : EK[2,5]:=-EK[2,2];
    : EK[2,6]:=-18*ci*(1+2*ki1[n]*ci)*Length/MS;
    : EK[3,3]:=12*ci*(1+3*ki2[n]*ci+Phi)*Length*Length/MS;
    : EK[3,5]:=-EK[2,3];
    : EK[3,6]:=6*ci*(1-2*Phi)*Length*Length/MS;
    : EK[4,4]:=EK[1,1];
    : EK[5,5]:=EK[2,2];
    : EK[5,6]:=-EK[2,6];
    : EK[6,6]:=12*ci*(1+3*ki1[n]*ci+Phi)*Length*Length/MS;
    :
    : For i2:=1 To 6 Do
    : For j2:=i2 To 6 Do EK[j2,i2]:=EK[i2,j2];
    :
    : { Do cung phan tu co lien ket mem va nut cung }
    : For i2:=1 To 6 Do
    : For j2:=1 To 6 Do
    : Begin
    : BD[i2,j2]:=0;
    : For k2:=1 To 6 Do BD[i2,j2]:=BD[i2,j2]+EK[i2,k2]*aLe[k2,j2];
    : End;
    : For i2:=1 To 6 Do
    : For j2:=1 To 6 Do
    : Begin
    : EK[i2,j2]:=0;
    : For k2:=1 To 6 Do EK[i2,j2]:=EK[i2,j2]+BD[k2,j2]*aLe[k2,i2];
    : End;
    :
    : { Dua ve ma tran do cung he thong }
    : For i2:=1 To 6 Do
    : For j2:=1 To 6 Do
    : Begin
    : BD[i2,j2]:=0;
    : For k2:=1 To 6 Do BD[i2,j2]:=BD[i2,j2]+EK[i2,k2]*a[k2,j2];
    : End;
    : If k11=1 Then
    : Begin
    : For i2:=1 To 6 Do
    : For j2:=1 To 6 do
    : Begin
    : EK[i2,j2]:=0;
    : For k2:=1 To 6 Do EK[i2,j2]:=EK[i2,j2]+BD[k2,j2]*a[k2,i2];
    : End;
    : End;
    : End;
    : {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    : PROCEDURE DO_CUNG;
    : Var
    : j3,k3,Nrowb,Ncolb,Ncol,n1,IC,Nx:Integer;
    : Begin
    : Mband:=0;
    : For n:=1 To NE Do
    : Begin
    : i:=Nop[n,1]; j:=Nop[n,2];
    : If Mband0 Then SK[Nrowb,Ncol]:=SK[Nrowb,Ncol]+EK[i,l];
    : End;
    : End;
    : End;
    : End;
    : End;
    : For n:=1 To NB Do
    : Begin
    : Nx:=1;
    : For k:=1 To Ndf-1 Do Nx:=Nx*10;
    : i:=Ibc[n];
    : Nrowb:=(i-1)*Ndf;
    : For m:=1 To Ndf Do
    : Begin
    : Nrowb:=Nrowb+1;
    : IC:=Trunc(Nfix[n]/Nx);
    : If IC>0 Then
    : Begin
    : SK[Nrowb,1]:=1;
    : For j:=2 To Mband Do
    : Begin
    : SK[Nrowb,j]:=0;
    : n1:=Nrowb+1-j;
    : If n1>0 Then SK[n1,j]:=0;
    : End;
    : Nfix[n]:=Nfix[n]-Nx*IC;
    : Nx:=Trunc(Nx/10);
    : End
    : Else Nx:=Trunc(Nx/10);
    : End;
    : End;
    : End;
    : {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    : PROCEDURE GIAI_HE_PHUONG_TRINH;
    : Var
    : C:Real;
    : Begin
    : For n:=1 To Nroe Do
    : Begin
    : i:=n;
    : For l:=2 To Mband Do
    : Begin
    : i:=i+1;
    : If SK[n,l]<>0 Then
    : Begin
    : C:=SK[n,l]/SK[n,1];
    : j:=0;
    : For k:=L To Mband Do
    : Begin
    : j:=j+1;
    : If SK[n,k]<>0 Then SK[i,j]:=Sk[i,j]-C*SK[n,k];
    : End;
    : SK[n,L]:=C;
    : R1[i]:=R1[i]-C*R1[n];
    : End;
    : End;
    : If SK[N,1]=0 Then SK[N,1]:=1E-15;
    : R1[n]:=R1[n]/SK[n,1];
    : End;
    : n:=Nroe;
    : Repeat
    : n:=n-1;
    : L:=n;
    : For k:=2 To Mband Do
    : Begin
    : L:=L+1;
    : If SK[n,k]<>0 Then R1[n]:=R1[n]-SK[n,k]*R1[L];
    : End;
    : Until n=1;
    : End;
    : {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    : PROCEDURE NOI_LUC;
    : Var
    : DIS :Array[1..Ndf,1..30] Of Real;
    : Force :Array[1..80,1..6] Of Real;
    : R :Array[1..6] Of Real;
    : ij,ia :Integer;
    : Begin
    : For i:=1 To NP Do
    : Begin
    : Dis[1,i]:=R1[Ndf*i-2];
    : Dis[2,i]:=R1[Ndf*i-1];
    : Dis[3,i]:=R1[Ndf*i]
    : End;
    : For i:=1 To NE Do
    : For j:=1 To 6 Do Force[i,j]:=0;
    : For N:=1 To NE Do
    : Begin
    : k11:=0;
    : CUNG(n);
    : For i:=1 To Ncn Do
    : Begin
    : m:=Nop[n,i];
    : k:=(i-1)*Ndf;
    : For j:=1 To Ndf Do
    : Begin
    : ij:=j+k;
    : R[ij]:=DIS[j,m];
    : End;
    : End;
    : For i:=1 To 6 Do
    : For j:=1 To 6 Do Force[N,i]:=Force[N,i]+BD[i,j]*R[j];
    : End;
    : Writeln(f2);
    : Writeln(f2,'':5,' K E T Q U A C H U Y E N V I');
    : Writeln(f2);
    : Writeln(f2,'':13,' Nut Ux Uy Goc');
    : Writeln(f2);
    : For m:=1 To NP Do
    : Writeln(f2,'':13,m:3,'':5,Dis[1,m]:10,'':5,Dis[2,m]:10,'':5,
    : Dis[3,m]:10);
    : Writeln(f2);
    : Writeln(f2,'':4,' K E T Q U A N O I L U C ');
    : Writeln(f2);
    : Writeln(f2,'':13,'Phan tu Luc Doc Luc Cat Momen ');
    : Writeln(f2);
    : For N:=1 To Ne Do
    : Begin
    : Writeln(f2,'':13,n:3,'',Force[N,1]:16:6,Force[n,2]:16:6,Force[N,3]:16:6);
    : Writeln(f2,'':16,Force[N,4]:16:6,Force[N,5]:16:6,Force[N,6]:16:6);
    : End;
    : Close(f2);
    : Writeln;
    : {
    : Writeln('':9,'Ket qua da duoc ghi vao file :.................. ',Tenfile);
    : Write('':9,'An ENTER de thoat khoi chuong trinh ............',#7);
    : Readln;
    : {}
    : Clrscr;
    : End;
    : {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    : BEGIN
    : ClrScr;
    : DOC_SO_LIEU;
    : DO_CUNG;
    : GIAI_HE_PHUONG_TRINH;
    : NOI_LUC;
    : END.
    : {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
    :
    :
    There are several small changes which I see:
    - add {$APPTYPE CONSOLE} just below the the line containing "program"
    - Remove the DOS and CRT units from the uses-list
    - Remove all ClrScr statements.
    Then it should compile correctly. If you get errors, they need to be dealt with individually.
Sign In or Register to comment.