Загрузка данных


Unit Unit1;

interface

uses System, System.Drawing, System.Windows.Forms;

type
  Form1 = class(Form)
    procedure button1_Click(sender: Object; e: EventArgs);
  {$region FormDesigner}
  internal
    {$resource Unit1.Form1.resources}
    label1: &Label;
    textBox1: TextBox;
    textBox2: TextBox;
    label2: &Label;
    textBox3: TextBox;
    label3: &Label;
    checkBox1: CheckBox;
    label4: &Label;
    button1: Button;
    {$include Unit1.Form1.inc}
  {$endregion FormDesigner}
  public
    constructor;
    begin
      InitializeComponent;
    end;
  end;

implementation

procedure Form1.button1_Click(sender: Object; e: EventArgs);
begin
  var i, sum, s, rate : integer; 
var sup_perc, sum_i : real;    
if (TextBox1.Text <> '') and (TextBox2.Text <> '') and 
(TextBox3.Text <> '') then 
begin 
sum := StrToInt(TextBox1.Text); 
s := StrToInt(TextBox2.Text); 
rate := StrToInt(TextBox3.Text);   
if CheckBox1.checked then 
begin 
sum_i := sum; 
for i := 1 to s do 
begin 
sum_i := sum_i + rate / 100 * sum_i; 
end; 
Label4.Text := Concat(FloatToStr(sum_i), ' руб.'); 
end 
else 
begin       
sup_perc := s * rate / 100 * sum; 
Label4.Text := Concat(FloatToStr(sum + sup_perc), ' руб.'); 
end; 
end 
else 
MessageBox.Show('Одно из полей не заполнено');
end;

end.