function TenIn16(x: integer): string; var s: string; begin repeat s := sixteen[x mod 16 + 1] + s; x := x div 16; until x = 0; if length(s) = 1 then s := '0' + s; TenIn16 := s; end;
var f1, f2: text; a1, a2, a3: byte;
begin assign(f1, 'record.txt'); reset(f1); assign(f2, 'result.txt'); rewrite(f2); while not eof(f1) do begin read(f1, a1, a2, a3); writeln(f2, TenIn16(a1), TenIn16(a2), TenIn16(a3)); end; close(f1); close(f2); end.
Ответить на вопрос
Поделитесь своими знаниями, ответьте на вопрос:
1. Составить программу алгоритма ветвления вычисления выражения: 2. (* Даны 2 числа a, b. Наименьшее уменьшить вдвое.
sixteen: string = '0123456789ABCDEF';
function TenIn16(x: integer): string;
var s: string;
begin
repeat
s := sixteen[x mod 16 + 1] + s;
x := x div 16;
until x = 0;
if length(s) = 1 then s := '0' + s;
TenIn16 := s;
end;
var
f1, f2: text;
a1, a2, a3: byte;
begin
assign(f1, 'record.txt');
reset(f1);
assign(f2, 'result.txt');
rewrite(f2);
while not eof(f1) do
begin
read(f1, a1, a2, a3);
writeln(f2, TenIn16(a1), TenIn16(a2), TenIn16(a3));
end;
close(f1);
close(f2);
end.