Где же баг? Помогите, пожалуйста, уважаемые профи!
uses crt;
var
a:array [1..100,1..100] of real;
i,j,n:integer;
max:real;
max_defined:boolean;
begin
clrscr;
max:=-10000;
writeln('There is a square real matrix. Count max from x-elements');
writeln('');
writeln('- x x x ');
writeln('o - x x ');
writeln('o o - x ');
writeln('o o o - ');
writeln('');
writeln ('Enter the dimension of the square matrix A:');
readln
;
while n<1 do
begin
writeln('Error! Wrong dimension');
writeln('');
writeln('Enter the correct dimension of the square matrix A:');
readln
;
end;
for i:=1 to n do
for j:=1 to n do
begin
writeln ('Enter the value of matrix A element a[',i,',',j,']');
readln (a[i,j]);
end;
max_defined:=false;
for i:=1 to n-1 do
for j:=i+1 to n do
if max_defined then
begin
if a[i,j]>max then max:=a[i,j];
else max_defined:=true;
end;
writeln('');
writeln('Matrix A:');
for i:=1 to n do
begin
writeln('');
for j:=1 to n do
begin
write (a[i,j]:0:0);
end;
end;
writeln('');
writeln('max element =',max:4:0);
readln;
end.
Ругается на строчку с else - пишет Error in statement. Где я не права?))
uses crt;
var
a:array [1..100,1..100] of real;
i,j,n:integer;
max:real;
max_defined:boolean;
begin
clrscr;
max:=-10000;
writeln('There is a square real matrix. Count max from x-elements');
writeln('');
writeln('- x x x ');
writeln('o - x x ');
writeln('o o - x ');
writeln('o o o - ');
writeln('');
writeln ('Enter the dimension of the square matrix A:');
readln
while n<1 do
begin
writeln('Error! Wrong dimension');
writeln('');
writeln('Enter the correct dimension of the square matrix A:');
readln
end;
for i:=1 to n do
for j:=1 to n do
begin
writeln ('Enter the value of matrix A element a[',i,',',j,']');
readln (a[i,j]);
end;
max_defined:=false;
for i:=1 to n-1 do
for j:=i+1 to n do
if max_defined then
begin
if a[i,j]>max then max:=a[i,j];
else max_defined:=true;
end;
writeln('');
writeln('Matrix A:');
for i:=1 to n do
begin
writeln('');
for j:=1 to n do
begin
write (a[i,j]:0:0);
end;
end;
writeln('');
writeln('max element =',max:4:0);
readln;
end.
Ругается на строчку с else - пишет Error in statement. Где я не права?))