implementation
procedure Form1.button1_Click(sender: Object; e: EventArgs);
var
a, b, result: real;
begin
try
a := StrToFloat(textBox1.Text);
b := StrToFloat(textBox2.Text);
result := a + b;
textBox3.Text := FloatToStr(result);
except
textBox3.Text := 'Ошибка ввода';
end;
end;
procedure Form1.button2_Click(sender: Object; e: EventArgs);
var
a, b, result: real;
begin
try
a := StrToFloat(textBox1.Text);
b := StrToFloat(textBox2.Text);
result := a - b;
textBox3.Text := FloatToStr(result);
except
textBox3.Text := 'Ошибка ввода';
end;
end;
procedure Form1.button3_Click(sender: Object; e: EventArgs);
var
a, b, result: real;
begin
try
a := StrToFloat(textBox1.Text);
b := StrToFloat(textBox2.Text);
result := a * b;
textBox3.Text := FloatToStr(result);
except
textBox3.Text := 'Ошибка ввода';
end;
end;
procedure Form1.button4_Click(sender: Object; e: EventArgs);
var
a, b, result: real;
begin
try
a := StrToFloat(textBox1.Text);
b := StrToFloat(textBox2.Text);
if b = 0 then
textBox3.Text := 'На ноль делить нельзя'
else
begin
result := a / b;
textBox3.Text := FloatToStr(result);
end;
except
textBox3.Text := 'Ошибка ввода';
end;
end;
end.