Добавил:
masterdos
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Т.С.П.П / Махинации с ТСПП / Махинации с ТСПП / ТПСПП / PR_1 (4) / PR_2 / PR_2_3 / Unit1
.cpp//---------------------------------------------------------------------------
#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();
Edit4->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Memo1->Clear();
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Edit4->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
float A,B,C;
float a,b,g,r;
a=StrToFloat(Edit3->Text);
b=StrToFloat(Edit2->Text);
g=StrToFloat(Edit1->Text);
r=StrToFloat(Edit1->Text);
A=2*r*sin(a*3.14/180);
B=2*r*sin(b*3.14/180);
C=2*r*sin(g*3.14/180);
Memo1->Lines->Add("Cторона А="+FloatToStrF(A, ffFixed, 7,3));
Memo1->Lines->Add("Cторона B="+FloatToStrF(B, ffFixed, 7,3));
Memo1->Lines->Add("Cторона C="+FloatToStrF(C, ffFixed, 7,3));
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit3KeyPress(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::Edit1KeyPress(TObject *Sender, char &Key)
{
if ((Key >= '0') && (Key <= '9')) {}
else if ((Key == 8) || (Key == ',')){}
else Key = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit4KeyPress(TObject *Sender, char &Key)
{
if ((Key >= '0') && (Key <= '9')) {}
else if ((Key == 8) || (Key == ',')){}
else Key = 0;
}
//---------------------------------------------------------------------------
Соседние файлы в папке PR_2_3