Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit3;
- interface
- uses
- Classes, StdCtrls, SysUtils;
- type
- Summator = class(TThread)
- private
- { Private declarations }
- protected
- procedure Summ;
- procedure Execute; override;
- public
- listbox_input: TListBox;
- listbox_output: TListBox;
- count: integer;
- sum: integer;
- end;
- implementation
- { Summator }
- procedure Summator.Execute;
- begin
- count := 1;
- while count < 100 do
- begin
- Synchronize(Summ);
- end;
- end;
- procedure Summator.Summ;
- var
- i: integer;
- begin
- if ((listbox_input.Items.Count div 10) >= count) then
- begin
- sum := 0;
- for i:=0 to 9 do
- begin
- sum := sum + StrToInt(listbox_input.Items[(count-1) * 10 + i]);
- end;
- listbox_output.Items.Add(IntToStr(sum));
- count := count + 1;
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment