-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFrmTablaMultiplicarUnit1.pas
113 lines (93 loc) · 2.85 KB
/
FrmTablaMultiplicarUnit1.pas
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
105
106
107
108
109
110
111
112
113
unit FrmTablaMultiplicarUnit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.CheckLst, Vcl.ExtCtrls;
type
TFrmTablaMultiplicar = class(TForm)
TablaCheckListBox: TCheckListBox;
TablaResultListBox: TListBox;
SeleccionRadioGroup: TRadioGroup;
AscRadioButton: TRadioButton;
DescRadioButton: TRadioButton;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure TablaCheckListBoxClickCheck(Sender: TObject);
procedure GenerarTablas();
procedure AscRadioButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmTablaMultiplicar: TFrmTablaMultiplicar;
implementation
{$R *.dfm}
procedure TFrmTablaMultiplicar.GenerarTablas();
var
I: Integer;
X: Integer;
var
contador:Integer;
num:Integer;
begin
TablaResultListBox.Clear;
if DescRadioButton.Checked then
begin
for I := 0 to TablaCheckListBox.Items.Count - 1 do
begin
if TablaCheckListBox.Checked[I] then
begin
num := StrToInt(TablaCheckListBox.Items[I]);
TablaResultListBox.Items.Add('======================');
TablaResultListBox.Items.Add('Tabla ' + IntToStr(num));
TablaResultListBox.Items.Add('======================');
contador :=12;
while contador > 0 do
begin
TablaResultListBox.Items.Add(IntToStr(num) +
' X ' + IntToStr(contador) +
' = ' + IntToStr((num * contador)));
contador := contador - 1;
end;
end;
end;
end
else if AscRadioButton.Checked then
begin
for I := 0 to TablaCheckListBox.Items.Count - 1 do
begin
if TablaCheckListBox.Checked[I] then
begin
num := StrToInt(TablaCheckListBox.Items[I]);
TablaResultListBox.Items.Add('======================');
TablaResultListBox.Items.Add('Tabla ' + IntToStr(num));
TablaResultListBox.Items.Add('======================');
for X := 1 to 12 do
begin
TablaResultListBox.Items.Add(IntToStr(num) + ' X ' + IntToStr(X) + ' = ' + IntToStr((num * x)))
end;
end;
end;
end;
end;
procedure TFrmTablaMultiplicar.AscRadioButtonClick(Sender: TObject);
begin
GenerarTablas();
end;
procedure TFrmTablaMultiplicar.FormCreate(Sender: TObject);
var
I: Integer;
begin
TablaCheckListBox.Clear;
for I := 1 to 12 do
begin
TablaCheckListBox.Items.Add(IntToStr(I));
end;
end;
procedure TFrmTablaMultiplicar.TablaCheckListBoxClickCheck(Sender: TObject);
begin
GenerarTablas();
end;
end.