Добавил:
masterdos
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Т.С.П.П / Махинации с ТСПП / 2раб(тпспп) / V2(Косенко) / 1 / U2A
.cpp//---------------------------------------------------------------------------
#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