pascal的语法错误;但是。发现?

时间:2021-11-29 19:10:49
program MouseInput;
Uses WinCrt,WinMouse, Graph;
Var GraphicsDriver, GraphicsMode :smallint;
x, y: smallint;
function GetMouseX: word;
function GetMouseY: word;
procedure InitMouse;
procedure DoneMouse;
Begin
     Writeln('Initialising Graphics, please wait...');
     GraphicsDriver := Detect;
     InitGraph(GraphicsDriver, GraphicsMode,'');
     begin
          InitMouse;
          Writeln('Move mouse cursor to square 10,10 to end');
          Repeat
                X:=GetMouseX;
                Y:=GetMouseY;
                Writeln('X,Y= (',X,',',Y,')');
          Until (X=9) and (Y=9);
          DoneMouse;
     end;
end.

The error pascal is throwing out is: 23 / 4 mouse.pas Fatal: Syntax error, ; expected but . found But i have got the correct number of begins and ends so becuase it is the last one it needs a '.'

帕斯卡抛出的错误是:23 / 4鼠标。pas致命:语法错误;但是。我找到了正确的开始和结束的数量,因为它是最后一个需要a的。

All the best Arran

所有最好的阿兰

2 个解决方案

#1


1  

You're missing the main program block, and then of course same for some of your functions procedures. The below will compile as it supplies the missing blocks, but of course it will do nothing.

你错过了主程序块,当然,你的一些函数程序也是一样的。下面将编译,因为它提供了丢失的块,但是当然它什么也不做。

program MouseInput;
Uses WinCrt,WinMouse, Graph;
Var GraphicsDriver, GraphicsMode :smallint;
x, y: smallint;

function GetMouseX: word;
begin
end;
function GetMouseY: word;
begin
end;
procedure InitMouse;
begin
end;

procedure DoneMouse;
Begin
     Writeln('Initialising Graphics, please wait...');
     GraphicsDriver := Detect;
     InitGraph(GraphicsDriver, GraphicsMode,'');
     begin
          InitMouse;
          Writeln('Move mouse cursor to square 10,10 to end');
          Repeat
                X:=GetMouseX;
                Y:=GetMouseY;
                Writeln('X,Y= (',X,',',Y,')');
          Until (X=9) and (Y=9);
          DoneMouse;
     end;
end;

begin
end.

#2


0  

Function monotone(
    A : Int_Array; {array [1..20] of integer}
    n : integer ) {size of the defined lower}
      : integer ; {portion of A}

VAR
i, {index for current limseq}
j, {index for predecessors of current limseq}
maxj, {length of current longest predecessors subsequence}
pmax, {end of current limseq inA[1..i-1]}
curr, {=A[i]}
maxl : integer; {length of limseq ending at pmax}
length : Int_Array; {length [k] is the length of}
                    {limseq at k}
    begin {monotone}
        {<STAD> Initialization of parameter A}
        {<STAD> Initialization of parameter n}
        length[1]:=1;
        pmax:=1;
        maxl:=1;
        i:=2;
        while i<=n do
        begin
            curr:=A[1];
            if curr<A[pmax} then
                begin
                    max j:=1;
                    j:=1;
                    while j<={i-1} do
                        begin 
                            if A[j]<curr then
                                begin
                                    if maxj<length[j] then
                                       maxj:=length[j];
                                end;
                            j:=j+1;
                        end;
                    length[i]:=maxj+1;
                    if length [i]>maxl+1;
                    pmax:=i;
                end;
            end   
        ELSE {if curr<A[pmax]}
            begin
                maxl:=maxl+1;
                length[i]:=maxl;
                pmax:=i;
            end;

        monotone:=maxl;
        {<STAD> EXIT USE OF monotone (FUNCTION RESULT)}
        end; {monotone}

#1


1  

You're missing the main program block, and then of course same for some of your functions procedures. The below will compile as it supplies the missing blocks, but of course it will do nothing.

你错过了主程序块,当然,你的一些函数程序也是一样的。下面将编译,因为它提供了丢失的块,但是当然它什么也不做。

program MouseInput;
Uses WinCrt,WinMouse, Graph;
Var GraphicsDriver, GraphicsMode :smallint;
x, y: smallint;

function GetMouseX: word;
begin
end;
function GetMouseY: word;
begin
end;
procedure InitMouse;
begin
end;

procedure DoneMouse;
Begin
     Writeln('Initialising Graphics, please wait...');
     GraphicsDriver := Detect;
     InitGraph(GraphicsDriver, GraphicsMode,'');
     begin
          InitMouse;
          Writeln('Move mouse cursor to square 10,10 to end');
          Repeat
                X:=GetMouseX;
                Y:=GetMouseY;
                Writeln('X,Y= (',X,',',Y,')');
          Until (X=9) and (Y=9);
          DoneMouse;
     end;
end;

begin
end.

#2


0  

Function monotone(
    A : Int_Array; {array [1..20] of integer}
    n : integer ) {size of the defined lower}
      : integer ; {portion of A}

VAR
i, {index for current limseq}
j, {index for predecessors of current limseq}
maxj, {length of current longest predecessors subsequence}
pmax, {end of current limseq inA[1..i-1]}
curr, {=A[i]}
maxl : integer; {length of limseq ending at pmax}
length : Int_Array; {length [k] is the length of}
                    {limseq at k}
    begin {monotone}
        {<STAD> Initialization of parameter A}
        {<STAD> Initialization of parameter n}
        length[1]:=1;
        pmax:=1;
        maxl:=1;
        i:=2;
        while i<=n do
        begin
            curr:=A[1];
            if curr<A[pmax} then
                begin
                    max j:=1;
                    j:=1;
                    while j<={i-1} do
                        begin 
                            if A[j]<curr then
                                begin
                                    if maxj<length[j] then
                                       maxj:=length[j];
                                end;
                            j:=j+1;
                        end;
                    length[i]:=maxj+1;
                    if length [i]>maxl+1;
                    pmax:=i;
                end;
            end   
        ELSE {if curr<A[pmax]}
            begin
                maxl:=maxl+1;
                length[i]:=maxl;
                pmax:=i;
            end;

        monotone:=maxl;
        {<STAD> EXIT USE OF monotone (FUNCTION RESULT)}
        end; {monotone}

相关文章