-
Notifications
You must be signed in to change notification settings - Fork 5
/
Compil.txt
96 lines (82 loc) · 2.23 KB
/
Compil.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
library CustomFunction;
uses SysUtils, Classes, Math;
{
Не большая справка по языку
Примеры:
**********************
function funct(x:Extended):Extended; stdcall;
begin
Result:=Sin(x);
end;
**********************
Тригонометрические функции
Cos(x) - Косинус
Sin(x) - Синус
Tan(x) - Тангенс
Cotan(x) - Катангенс
ArcCot(x) - Арккотангенс
Cosecant(x) - Косеканс
Secant(x) - Секанс
**********************
Floor(x) - Лесница
Exp(x) - Экспанента
Power(x) - Возведение в степень
Abs(x) - Модульные скобки
Round(x) - Округление
Trunc(x) - Отбросить дробную часть
Inc(x) - Увеличить x на 1
Inc(x, n) - Увеличить x на n
Dec(x) - Уменьшить x на 1
Dec(x, n) - Уменьшить x на n
Sqr(x) - Квадрат x
Sqrt(x) - Корень числа x
**********************
Пример функции: Квадратное уравнение
function funct(x:Extended):Extended; stdcall;
begin
//2x^2+3x+6 -- Два x в квадрате, плюс три x, плюс шесть
Result:=(2*Power(x, 2))+(3*x)+6;
end;
Операторы:
:= - Присвоить
+ - Сложить (X+1)
- - Вычесть (X-1)
* - Умножить (X*2)
/ - Разделить (X/2)
Условная конструкция: if then else (если, то, в противном случае)
Например:
if x = 2 then x:=x+3; (если x равен 2, то увеличиваем x на 3)
if x = 2 then x:=x+3 else x:=x-2; (если x равен 2, то увеличиваем x на 3, в противном случае уменьшаем x на 2)
if (x < 2) or (x = 3) then Dec(x, 3.4); (если x меньше 2 или x равен 3, то уменьшаем x на 3.4)
or - Логическое "ИЛИ"
and - Логическое "И"
not - Логическое "НЕ"
mod - остаток от деления
div - деление нацело
< - меньше
> - больше
= - равно
<> - неравно
<= - меньше либо равно
>= - больше либо равно
Это, есть максимально урезанный набор знаний для построения функции в Delphi.
}
const FunctName = 'Sin(x)*(x+2)+6';
function funct(x:Extended):Extended; stdcall;
begin
//Укажите алгебраическое выражение, необходимой функции,
//используя стандартные функции и процедуры языка Pascal - Delphi
//Не забудьте вернуть результат: присвоить Result результат вашей функции.
//Result:=Power(x, 2);
//Result:=Sqrt(x);
Result:=Sin(x)*(x+2)+6;
end;
function get_name:string; stdcall;
begin
Result:=FunctName;
end;
exports funct;
exports get_name;
begin
end.
//---------------------------------------------------------------