А что мешает вставить в виде функции?
У Вас структура такая:
program...
//модули
//переменные
begin
//код
end.
а с функцией будет так:
program...
//модули
//переменные
//ФУНКЦИЯ
function Power(x,y:real):real;
begin
if x=0 then
Power:=0
else if x>0 then
Power:=exp(ln(x)*y)
else
Power:=-exp(ln(abs(x))*y);
end;
begin
//код
end.
Ну и вместо
res := 1;
i := 0;
while i < abs(deg) do begin
res := res * num;
i := i + 1
end;
if deg < 0 then
res := 1 / res;
writeln (res:0:5);
использовать
writeln(Power(num,deg):0:5);