, . 1.2.
. 1.2
.
1. ++ Builder. (d:\work\ c:\work\) (\610101\), , Unit 1. cpp Project 1. cpp ( ).
2. , Form 1 . Label 1, Label 2, Label 3, Label 4 ( Caption ), Edit 1, Edit 2, Edit 3, Memo 1 c (. . 1.3), Button 1 ( Caption ).
Font, .
3. (U nit 1. cpp). FormCreate (. ). (F 12), ܻ Button 1 Click (. ).
4. , .
5. , .
( , ):
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "math.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1:: FormCreate (TObject *Sender)
{
Edit1->Text = "3,4";
Edit2->Text = "7,4e-2";
Edit3->Text = "1,943e2";
Memo1->Clear();
Memo1->Lines->Add(" 1");
}
//---------------------------------------------------------------------------
void __fastcall TForm1:: Button1Click (TObject *Sender)
{
double x, y, z, a, b,c, rez;
x = StrToFloat(Edit1->Text);
y = StrToFloat(Edit2->Text);
z = StrToFloat(Edit3->Text);
a = pow(tan(x+y),2);
b = exp(y-z);
c = sqrt(cos(x*x)+sin(z*z));
rez = a-b*c;
Memo1->Lines->Add(" = "+FloatToStrF(x,ffFixed,7,3)
+ "; y = "+FloatToStrF(y,ffFixed,7,3)+"; z = "+FloatToStrF(z,ffFixed,7,3));
Memo1->Lines->Add(" = "+FloatToStr(rez));
}
! : Edit1->Text = "3,4"; .
(. 1.3). , Memo 1 (). Edit * , , .
. 1.3