![Старый](images/statusicon/post_old.gif)
27.03.2017, 18:49
|
Модератор
|
|
Регистрация: 17.04.2008
Сообщения: 8,047
Версия Delphi: 7, XE3, 10.2
Репутация: 49089
|
|
Ну. например, так:
Код:
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils, Math;
function f(x, y : integer) : double;
begin
result := (sqr(tan(x))+sqr(sin(x))*sin(x)) / (exp(-1*y)-ln(abs(y)));
end;
function getmin(a : array of integer) : Integer;
var
i : integer;
begin
result := a[low(a)];
for i := low(a)+1 to high(a) do
if a[i] < result then result := a[i];
end;
procedure randomizearray(var a : array of integer);
var
i : integer;
begin
for i := low(a) to high(a) do
a[i] := random(100);
end;
var
a, b : array of integer;
res : double;
m_a, m_b : integer;
begin
randomize;
try
// create arrays
setlength(a,random(100));
setlength(b,random(100));
randomizearray(a);
randomizearray(b);
// find the result
m_a := getmin(a);
m_b := getmin(b);
res := f(m_a,m_b);
writeln(format('f(%d,%d)=%f',[m_a,m_b,res]));
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
readln;
end.
|