:
S = S = a*b* sin(a^b), p ; a, b, c
.
Þ Caption Form1 .
Þ 4 : Edit1, Edit2, Edit3, Edit4 InpA, InpB, InpC, Result. Name .
Þ , , View/Alignment Palette .
Þ ( , Text).
Þ - Label1, Label2, Label3, Label4 , B, ѻ . Label1, Caption .
Þ GroupBox1 .
Þ RadioButton1 RadioButton2 .
Þ OnCreate (, ), ..
{ RadioButton1->Checked = true; }
Þ RadioButton2 ( OnClick) a b. RadioButton2Click Label3 , RadioButton1Click ѻ
Þ Button1, (Caption) .
Þ , Button1. OnClick. . , .
#include <math.h>
void __fastcall TForm1::Button1Click(TObject *Sender)
{ float s,p; //
int a, b, c; //
if ((InpA->Text!= "")&&(InpB->Text!= "")&&(InpC->Text!= ""))
{ a = StrToInt(InpA->Text); b = StrToInt(InpB->Text);
if (RadioButton1->Checked == true)
{ c = StrToInt(InpC->Text);
p =(a+b+c)/2; //
s = sqrt(p*(p-a)*(p-b)*(p-c));
Result->Text = FloatToStr(s);
}
else
{ p = StrToInt(InpC->Text);
s = a*b*sin(p*3.141592654/180);
Result->Text = FloatToStr(s); }
}
}
Þ ComboBox1. InpA, InpB, InpC ., . Items , OnChange
switch (ComboBox1->ItemIndex)
{case0: InpA->Color=clYellow; InpB->Color=clYellow; InpC->Color=clYellow;
break;
case1: InpA->Color=clSilver;InpB->Color=clSilver;InpC->Color=clSilver;break;}
Þ CheckBox1, ComboBox1, .. - , . , OnClick CheckBox1
{ if (CheckBox1->Checked == true)
ComboBox1->Visible = true;
else
ComboBox1->Visible = false;
}
Þ (F9).