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

#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::Button2Click(TObject *Sender)
{
 Memo1->Clear();
 Edit1->Clear();
 Edit2->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
 Memo1->Clear();
 Edit1->Clear();
 Edit2->Clear();
 RadioGroup1->ItemIndex = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
 float y,x;
 float a,b,c,d;
 x=StrToFloat(Edit1->Text);
 y=StrToFloat(Edit2->Text);
 switch(RadioGroup1->ItemIndex)
 {
  case 0: a=(cos(x)/3.14-2*x)+((16*x)*cos(x*y)-2);
          Memo1->Lines->Add("A="+FloatToStrF(a, ffFixed, 7,3));
          break;
  case 1: b=pow(2,-x)-cos(x)-(sin(2*x*y));
          Memo1->Lines->Add("B="+FloatToStrF(b, ffFixed, 7,3));
          break;
  case 2: c=2*(atan(3*x))-(1/(12*pow(x,2)+7*x-5));
          Memo1->Lines->Add("C="+FloatToStrF(c, ffFixed, 7,3));
          break;
  case 3: d=abs(pow(x,2)-pow(x,3))-((7*x)/(pow(x,3)-15*x));
          Memo1->Lines->Add("D="+FloatToStrF(d, ffFixed, 7,3));
          break;
  }
}
//---------------------------------------------------------------------------

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;
}
//---------------------------------------------------------------------------
Соседние файлы в папке PR_1
  • #
    30.05.20201.07 Кб0Project1.cpp
  • #
    30.05.202017.75 Кб0Project1.obj
  • #
    30.05.2020876 б0Project1.res
  • #
    30.05.20202.03 Mб0Project1.tds
  • #
    30.05.20203.89 Кб0Project1.~bpr
  • #
    30.05.20202.27 Кб0Unit1.cpp
  • #
    30.05.202051 б0Unit1.ddp
  • #
    30.05.20202.86 Кб0Unit1.dfm
  • #
    30.05.20201.28 Кб0Unit1.h
  • #
    30.05.202043.65 Кб0Unit1.obj
  • #
    30.05.20202.28 Кб0Unit1.~cpp