Saw such a lot of questions, but still ask it again (Then my program, the problems marked with the comment):

Var Mass:array [1..10] of real; i,k:integer; a,b:real;

Begin

Phony(Mass[1],Mass[2],Mass[3],Mass[4],Mass[5],Mass[6],Mass[7],Mass[8],Mass[9],Mass[10]);

For i:=1 to 10 do

a:=a+Mass[i];

a:=a/10;

Repeat

Begin

inc(i);

If Mass[i]>Mass[i+1] then

b:=Mass[i]-a;

Mass[i]:=b;

Mass[i+1]:=Mass[i+1]+a;

inc(k);

End;

Else //this moment

Begin

b:=Mass[i+1]-a;

Mass[i+1]:=b;

Mass[i]:=Mass[i]+a;

inc(k);

End;

Until i<>10

Writeln(k);

End.

After populating the array I get an error that "Met Else, and expected operator"

If (rule) to remove the semicolon before the Else, then swear he was starting to no

By the way, this problem occurs not only with Repeat-loop, but with the rest, if it certainly is useful information.

I would be grateful for help

Var Mass:array [1..10] of real; i,k:integer; a,b:real;

Begin

Phony(Mass[1],Mass[2],Mass[3],Mass[4],Mass[5],Mass[6],Mass[7],Mass[8],Mass[9],Mass[10]);

For i:=1 to 10 do

a:=a+Mass[i];

a:=a/10;

Repeat

Begin

inc(i);

If Mass[i]>Mass[i+1] then

b:=Mass[i]-a;

Mass[i]:=b;

Mass[i+1]:=Mass[i+1]+a;

inc(k);

End;

Else //this moment

Begin

b:=Mass[i+1]-a;

Mass[i+1]:=b;

Mass[i]:=Mass[i]+a;

inc(k);

End;

Until i<>10

Writeln(k);

End.

After populating the array I get an error that "Met Else, and expected operator"

If (rule) to remove the semicolon before the Else, then swear he was starting to no

By the way, this problem occurs not only with Repeat-loop, but with the rest, if it certainly is useful information.

I would be grateful for help

asked June 14th 19 at 20:03

Find more questions by tags Pascal