Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Программирование на Pascal / Delphi / Лабораторная работа1 / LAB_9
.PAS program lab_9;
uses crt;
const
n=40;
var
f,g:file of integer;
i,j,ch,pos,h:integer;
begin
clrscr;
randomize;
assign(f,'C:\f.txt');
assign(g,'C:\g.txt');
writeln('‡ ЇЁбм зЁбҐ« ў д ©«');
reset(f);
repeat
j:=j+1;
for i:=1 to 10 do
begin
if j mod 2=0 then
repeat
ch:=random(20)-13;
textcolor(4);
until ch<0
else
repeat
textcolor(3);
ch:=random(20)-5;
until ch>0;
write(f,ch);
write(ch:3);
end;
until j=n/10;
close(f);
reset(f);
reset(g);
writeln;
j:=0;
repeat
j:=j+1;
if j mod 2<>0 then
begin
for i:=1 to 5 do
begin
textcolor(3);
read(f,ch);
write(g,ch);
write(ch:3);
pos:=filepos(f);
end;
seek(f,pos+5);
end
else
begin
for i:=1 to 5 do
begin
textcolor(4);
read(f,ch);
write(g,ch);
write(ch:3);
end;
pos:=filepos(f);
if pos<>20 then seek(f,pos-10);
end;
until j=n/5;
readkey;
end.
uses crt;
const
n=40;
var
f,g:file of integer;
i,j,ch,pos,h:integer;
begin
clrscr;
randomize;
assign(f,'C:\f.txt');
assign(g,'C:\g.txt');
writeln('‡ ЇЁбм зЁбҐ« ў д ©«');
reset(f);
repeat
j:=j+1;
for i:=1 to 10 do
begin
if j mod 2=0 then
repeat
ch:=random(20)-13;
textcolor(4);
until ch<0
else
repeat
textcolor(3);
ch:=random(20)-5;
until ch>0;
write(f,ch);
write(ch:3);
end;
until j=n/10;
close(f);
reset(f);
reset(g);
writeln;
j:=0;
repeat
j:=j+1;
if j mod 2<>0 then
begin
for i:=1 to 5 do
begin
textcolor(3);
read(f,ch);
write(g,ch);
write(ch:3);
pos:=filepos(f);
end;
seek(f,pos+5);
end
else
begin
for i:=1 to 5 do
begin
textcolor(4);
read(f,ch);
write(g,ch);
write(ch:3);
end;
pos:=filepos(f);
if pos<>20 then seek(f,pos-10);
end;
until j=n/5;
readkey;
end.
Соседние файлы в папке Лабораторная работа1