Var f,s:text; st,sp:string; i:integer; c:char; begin assign(s,'text1.txt'); reset(s); while not Eof(s) do begin; readln(s,sp); st:=st+sp+chr(10)+chr(13); end; close(s); for i:=1 to length(st) div 2 do begin c:=st[i]; st[i]:=st[length(st)-i+1]; st[length(st)-i+1]:=c; end; assign(f,'text.txt'); rewrite(f); write(f,st); close(f); end.
Текст в файле text1.txt:
Simple text 1And another simple text 2New text
Текст в файле text.txt: txet weN2 txet elpmis rehtona dnA1 txet elpmiS
Var
f,s:text;
st,sp:string;
i:integer;
c:char;
begin
assign(s,'text1.txt');
reset(s);
while not Eof(s) do
begin;
readln(s,sp);
st:=st+sp+chr(10)+chr(13);
end;
close(s);
for i:=1 to length(st) div 2 do
begin
c:=st[i];
st[i]:=st[length(st)-i+1];
st[length(st)-i+1]:=c;
end;
assign(f,'text.txt');
rewrite(f);
write(f,st);
close(f);
end.
Текст в файле text1.txt:
Simple text
1And another simple text
2New text
Текст в файле text.txt:
txet weN2
txet elpmis rehtona dnA1
txet elpmiS
var
n,k:integer;
a:array of integer;
s,k2:real;
begin
{Ввод размера массива и элементов массива}
while n<3 do begin
write('Введите размер массива - '); readln(n);
if n<3 then writeln('[Массив слишком короткий]');
end;
setLength(a,n);
for var i1:=0 to n-1 do begin
write('Введите ',i1+1,' элемент массива - '); readln(a[i1]);
end;
{Вычесление минимальной суммы трёх соседних элементов массива}
s:=a[0]+a[1]+a[2];
for var i2:=2 to n-2 do begin
k:=a[i2-1]+a[i2]+a[i2+1];
if s>k then s:=k;
end;
writeln('Минимальная сумма трёх соседних элементов = ',s);
{Выполнение условия чётности и нечётности}
k2:=s;
while k2>=2 do begin
k2:=k2-2;
end;
if k2=0 then s:=sqr(s)
else s:=sqrt(s);
write('ответ: ',s:0:3);
end.