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

#include <vcl.h>
#pragma hdrstop

#include "U2A.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2A *Form2A;
//---------------------------------------------------------------------------
__fastcall TForm2A::TForm2A(TComponent* Owner)
        : TForm(Owner)
{
Memo1->Clear();
Memo1->ReadOnly=True;
}
//---------------------------------------------------------------------------

void __fastcall TForm2A::Button1Click(TObject *Sender)
{
if (Edit1->Text=="" || Edit2->Text=="" ||Edit3->Text=="")
ShowMessage("Будь-ласка, введіть значення");
else
{
int a,b,c,s1,s2,s3;
a = StrToFloat(Edit1->Text);
b = StrToFloat(Edit2->Text);
c = StrToFloat(Edit3->Text);
s1=a+b;
s2=b+c;      
s3=a+c;
Memo1->Clear();
if (s1>0)
Memo1->Lines->Add("Сума чисел А і В - позитивна");
if (s2>0)
Memo1->Lines->Add("Сума чисел B і C - позитивна");
if (s3>0)
Memo1->Lines->Add("Сума чисел А і C - позитивна");
if (s1<=0 && s2<=0 && s3<=0)
Memo1->Text=("Позитивної суми чисел немае");
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2A::Button2Click(TObject *Sender)
{
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Memo1->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm2A::Edit1KeyPress(TObject *Sender, char &Key)
{
if (((Key>='0') && (Key<='9')) || (Key==VK_BACK) || (Key==',') || (Key=='-'))
  return;
if (Key==VK_RETURN)
  Button1->SetFocus();
Key=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm2A::Edit2KeyPress(TObject *Sender, char &Key)
{
if (((Key>='0') && (Key<='9')) || (Key==VK_BACK) || (Key==',') || (Key=='-'))
  return;
if (Key==VK_RETURN)
  Button1->SetFocus();
Key=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm2A::Edit3KeyPress(TObject *Sender, char &Key)
{
if (((Key>='0') && (Key<='9')) || (Key==VK_BACK) || (Key==',') || (Key=='-'))
  return;
if (Key==VK_RETURN)
  Button1->SetFocus();
Key=0;        
}
//---------------------------------------------------------------------------
void __fastcall TForm2A::Button3Click(TObject *Sender)
{
Form2A->Close();
}
//---------------------------------------------------------------------------

void __fastcall TForm2A::Memo1KeyPress(TObject *Sender, char &Key)
{
Key=0;        
}
//---------------------------------------------------------------------------

Соседние файлы в папке 1
  • #
    30.05.202018.46 Кб1Project2A.obj
  • #
    30.05.2020876 б0Project2A.res
  • #
    30.05.20202.03 Mб0Project2A.tds
  • #
    30.05.20203.9 Кб0Project2A.~bpr
  • #
    30.05.20201.07 Кб0Project2A.~cpp
  • #
    30.05.20202.69 Кб0U2A.cpp
  • #
    30.05.202051 б0U2A.ddp
  • #
    30.05.20204.01 Кб1U2A.dfm
  • #
    30.05.20201.44 Кб0U2A.h
  • #
    30.05.202044.98 Кб0U2A.obj
  • #
    30.05.20202.31 Кб0U2A.~cpp