1) var f:text; a:array[1..7] of real; i,k,c,x:integer; s:string; begin for i:=1 to 7 do begin readln(x); a[i]:=x; end; assign(f,'file.txt'); rewrite(f); for i:=1 to 7 do begin str(a[i],s); writeln(f,s); end; close(f); reset(f); k:=0; while not eof(f) do begin readln(f,s); val(s,x,c); if x<0 then k:=k+1; end; close(f); if k<>0 then writeln('В массиве ',k,' отрицательных элемента(ов)'); else writeln('В массиве нет отрицательных элементов'); erase(f); end.
2) Var a,b,c,d:integer;
Function max(a,b:integer):integer; begin if a>b then max:=a else max:=b; end;
Begin readln(a,b,c,d); a:=(max(a,b)); b:=(max(c,d)); writeln('max=',max(a,b)); End.
var f:text; a:array[1..7] of real; i,k,c,x:integer; s:string;
begin
for i:=1 to 7 do
begin
readln(x);
a[i]:=x;
end;
assign(f,'file.txt');
rewrite(f);
for i:=1 to 7 do
begin
str(a[i],s);
writeln(f,s);
end;
close(f);
reset(f);
k:=0;
while not eof(f) do
begin
readln(f,s);
val(s,x,c);
if x<0 then k:=k+1;
end;
close(f);
if k<>0 then writeln('В массиве ',k,' отрицательных элемента(ов)');
else writeln('В массиве нет отрицательных элементов');
erase(f);
end.
2)
Var a,b,c,d:integer;
Function max(a,b:integer):integer;
begin
if a>b then max:=a
else max:=b;
end;
Begin
readln(a,b,c,d);
a:=(max(a,b));
b:=(max(c,d));
writeln('max=',max(a,b));
End.
function Len(x1,y1, x2, y2:real):real;
begin
Len := sqrt( sqr(x1 - x2) + sqr(y1 - y2) );
end;
var
x1,x2,x3,x4,x5, y1, y2, y3, y4, y5:real;
begin
write('x1 = '); readln(x1);
write('y1 = '); readln(y1);
write('x2 = '); readln(x2);
write('y2 = '); readln(y2);
write('x3 = '); readln(x3);
write('y3 = '); readln(y3);
write('x4 = '); readln(x4);
write('y4 = '); readln(y4);
write('x5 = '); readln(x5);
write('y5 = '); readln(y5);
writeln('P = ', Len(x1,y1,x2,y2) + Len(x2,y2,x3,y3) + Len(x3,y3,x4,y4) + Len(x4,y4,x5,y5) + Len(x5,y5,x1,y1));
end.