Код
Program Laba21;
uses crt;
var f1,f2:text;
x1,x2,x,x3:integer;
s_:string;
st:string;
Procedure Pere(st:string; x1:integer);
begin
s_:='';
Repeat
s_:=st[x1 mod 9+1]+s_;
x1:=x1 div 9;
until x1=0;
writeln(' chislo ',s_);
end;
BEGIN
clrscr;
st:='0123456789';
assign(f1,'Input.txt');
reset(f1);
assign(f2,'Output.txt');
rewrite(f2);
read(f1,x1);
Pere(st,x1);
write(f2,s_);
read(f1,x);
while not eof(f1) do
begin
read(f1,x2);
x1:=x;
x:=x2;
Pere(st,x1);
write(f2,' ',s_);
end;
Pere(st,x2);
write(f2,' ',s_);
close(f1);
close(f2);
readln;
end.
uses crt;
var f1,f2:text;
x1,x2,x,x3:integer;
s_:string;
st:string;
Procedure Pere(st:string; x1:integer);
begin
s_:='';
Repeat
s_:=st[x1 mod 9+1]+s_;
x1:=x1 div 9;
until x1=0;
writeln(' chislo ',s_);
end;
BEGIN
clrscr;
st:='0123456789';
assign(f1,'Input.txt');
reset(f1);
assign(f2,'Output.txt');
rewrite(f2);
read(f1,x1);
Pere(st,x1);
write(f2,s_);
read(f1,x);
while not eof(f1) do
begin
read(f1,x2);
x1:=x;
x:=x2;
Pere(st,x1);
write(f2,' ',s_);
end;
Pere(st,x2);
write(f2,' ',s_);
close(f1);
close(f2);
readln;
end.
и почему
Код
s_:=st[x1 mod 9+1]+s_;
а не просто 9.