Amaliy ish
Borland C++ Builder tilida bir misol korip shiqaylik.
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "Unit1.h"
#include
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
double x, y;
const pi=3.14;
x=StrToFloat(Edit1->Text);
if(x<0.5)
{
y=0.5*pow(x,2)/pow((x+0.5),2);
}
else
{
y=sqrt(pow(x,2)+3.5*pow(x,3));
}
Label2->Caption="y="+FloatToStr(y);
}
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "Unit1.h"
#include
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
|