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
Uses Crt; const n=5; m=7; type Mas = array [1..n, 1..m] of integer; var i, j, j1, j2: integer; Sumj1, Sumj2: real; A: Mas; begin ClrScr; Randomize; SumJ1:=0; SumJ2:=0; for i:=1 to n do for j:=1 to m do A[i,j]:=random (10); WriteLn (' Massiv A: '); for i:=1 to n do begin for j:=1 to m do Write (A[i,j]:4); WriteLn; end; WriteLn; repeat Write (' Stolbez #1 = '); ReadLn(j1); until (j1>=1) and (j1<=m); repeat Write (' Stolbez #2 = '); ReadLn(j2); until (j2>=1) and (j2<=m) and (j1<>j2); for i:= 1 to n do SumJ1 := SumJ1+A[i,j1]; for i:= 1 to n do SumJ2:=SumJ2+A[i,j2]; SumJ1:=SumJ1/n; SumJ2:=SumJ2/n; WriteLn; WriteLn (' Srednee stolbza ', j1, ' = ', SumJ1:4:2); WriteLn (' Srednee stolbza ', j2, ' = ', SumJ2:4:2); ReadLn; end.
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
const n=5; m=7;
type Mas = array [1..n, 1..m] of integer;
var i, j, j1, j2: integer;
Sumj1, Sumj2: real;
A: Mas;
begin
ClrScr;
Randomize;
SumJ1:=0; SumJ2:=0;
for i:=1 to n do
for j:=1 to m do
A[i,j]:=random (10);
WriteLn (' Massiv A: ');
for i:=1 to n do
begin
for j:=1 to m do
Write (A[i,j]:4);
WriteLn;
end; WriteLn;
repeat
Write (' Stolbez #1 = '); ReadLn(j1);
until (j1>=1) and (j1<=m);
repeat
Write (' Stolbez #2 = '); ReadLn(j2);
until (j2>=1) and (j2<=m) and (j1<>j2);
for i:= 1 to n do
SumJ1 := SumJ1+A[i,j1];
for i:= 1 to n do
SumJ2:=SumJ2+A[i,j2];
SumJ1:=SumJ1/n; SumJ2:=SumJ2/n;
WriteLn;
WriteLn (' Srednee stolbza ', j1, ' = ', SumJ1:4:2);
WriteLn (' Srednee stolbza ', j2, ' = ', SumJ2:4:2);
ReadLn;
end.