Скачиваний:
2
Добавлен:
30.05.2020
Размер:
2.15 Кб
Скачать
//---------------------------------------------------------------------------

#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)
{
 Memo1->Clear();
 Edit1->Clear();
 Edit2->Clear();
 Edit3->Clear();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
 Memo1->Clear();
 Edit1->Clear();
 Edit2->Clear();
 Edit3->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
 float A,B,C;
 float p,s1,r,s;
 A=StrToFloat(Edit3->Text);
 B=StrToFloat(Edit2->Text);
 C=StrToFloat(Edit1->Text);
 p=(A+B+C)/2;
 s1=sqrt(p*(p-A)*(p-B)*(p-C));
 r=(s1/p);
 s=3.14*pow(r,2);
 Memo1->Lines->Add("Площа круга, вписаного в трикутник="+FloatToStrF(s , ffFixed, 7,3));
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key)
{
 if ((Key >= '0') && (Key <= '9')) {}
 else if ((Key == 8) || (Key == ',')){}
 else Key = 0;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Edit2KeyPress(TObject *Sender, char &Key)
{
 if ((Key >= '0') && (Key <= '9')) {}
 else if ((Key == 8) || (Key == ',')){}
 else Key = 0;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Edit3KeyPress(TObject *Sender, char &Key)
{
 if ((Key >= '0') && (Key <= '9')) {}
 else if ((Key == 8) || (Key == ',')){}
 else Key = 0;        
}
//---------------------------------------------------------------------------

Соседние файлы в папке PR_2_1
  • #
    30.05.20203.73 Кб2Project1.bpr
  • #
    30.05.20201.07 Кб2Project1.cpp
  • #
    30.05.202017.75 Кб2Project1.obj
  • #
    30.05.2020876 б2Project1.res
  • #
    30.05.20202.03 Mб2Project1.tds
  • #
    30.05.20202.15 Кб2Unit1.cpp
  • #
    30.05.202051 б2Unit1.ddp
  • #
    30.05.20202.8 Кб2Unit1.dfm
  • #
    30.05.20201.34 Кб2Unit1.h
  • #
    30.05.202042.63 Кб2Unit1.obj
  • #
    30.05.20202.15 Кб2Unit1.~cpp