-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathunit1.pas
More file actions
105 lines (88 loc) · 3.84 KB
/
unit1.pas
File metadata and controls
105 lines (88 loc) · 3.84 KB
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
97
98
99
100
101
102
103
104
(******************************************************************************)
(* Intercept theorem ??.??.???? *)
(* *)
(* Version : 0.01 *)
(* *)
(* Author : Uwe Schächterle (Corpsman) *)
(* *)
(* Support : www.Corpsman.de *)
(* *)
(* Description : Demo to calculate the fourth missing value of the intercept *)
(* theorem *)
(* *)
(* License : See the file license.md, located under: *)
(* https://github.com/PascalCorpsman/Software_Licenses/blob/main/license.md *)
(* for details about the license. *)
(* *)
(* It is not allowed to change or remove this text from any *)
(* source file of the project. *)
(* *)
(* Warranty : There is no warranty, neither in correctness of the *)
(* implementation, nor anything other that could happen *)
(* or go wrong, use at your own risk. *)
(* *)
(* Known Issues: none *)
(* *)
(* History : 0.01 - Initial version *)
(* *)
(******************************************************************************)
Unit Unit1;
{$MODE objfpc}{$H+}
Interface
Uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
Type
{ TForm1 }
TForm1 = Class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Label1: TLabel;
Procedure Button1Click(Sender: TObject);
Procedure Edit1KeyPress(Sender: TObject; Var Key: char);
Procedure FormCreate(Sender: TObject);
private
public
End;
Var
Form1: TForm1;
Implementation
{$R *.lfm}
{ TForm1 }
Procedure TForm1.FormCreate(Sender: TObject);
Begin
Constraints.MinHeight := Height;
Constraints.MaxHeight := Height;
Constraints.MinWidth := Width;
Constraints.MaxWidth := Width;
edit1.text := '100';
edit2.text := '50';
edit3.text := '200';
edit4.text := '?';
edit5.text := '';
caption := 'Intercept theorem ver. 0.01';
End;
Procedure TForm1.Edit1KeyPress(Sender: TObject; Var Key: char);
Begin
If key = #13 Then Button1.Click;
End;
Procedure TForm1.Button1Click(Sender: TObject);
Begin
//
If trim(edit1.text) = '?' Then Begin
edit5.text := FloatToStr(strtofloat(edit3.text) * strtofloat(edit2.text) / strtofloat(edit4.text));
End;
If trim(edit2.text) = '?' Then Begin
edit5.text := FloatToStr(strtofloat(edit1.text) * strtofloat(edit4.text) / strtofloat(edit3.text));
End;
If trim(edit3.text) = '?' Then Begin
edit5.text := FloatToStr(strtofloat(edit1.text) * strtofloat(edit4.text) / strtofloat(edit2.text));
End;
If trim(edit4.text) = '?' Then Begin
edit5.text := FloatToStr(strtofloat(edit3.text) * strtofloat(edit2.text) / strtofloat(edit1.text));
End;
End;
End.