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

#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)
{
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Label1->Hide();
Label2->Hide();
Label3->Hide();
Label4->Hide();
Edit1->Hide();
Edit2->Hide();
Edit3->Hide();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
switch(RadioGroup1 ->ItemIndex) {
case 0: Label1->Show();
        Label2->Hide();
        Label3->Hide();
        Edit1->Show();
        Edit2->Show();
        Edit3->Show();
        Label4->Show(); break;
case 1: Edit2->Show();
        Label3->Hide();
        Label1->Hide();
        Label2->Show();
        Label4->Show();
        Edit1->Hide();
        Edit3->Hide(); break;
case 2: Label4->Show();
        Label3->Show();
        Edit2->Show();
        Edit1->Hide();
        Edit3->Hide();
        Label1->Hide();
        Label2->Hide(); break;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
int d, m, y, g, v;
switch(RadioGroup1 ->ItemIndex) {
case 0: d=StrToInt(Edit1->Text);
        m=StrToInt(Edit2->Text);
        y=StrToInt(Edit3->Text); {
        if((d<1) || (d>31)) { Label4->Caption="Ошибка";  }
        else { Label4->Caption="Правильно";   }
        if((m<1) || (m>12))  { Label4->Caption="Ошибка";  }
        else {Label4->Caption="Правильно"; }
        if((y<1) || (y>2014)){ Label4->Caption="Ошибка";  }
        else {Label4->Caption="Правильно";  }
        if ((d>30) && (m<8) && (m%2==0) || (m!=8)){Label4->Caption="Ошибка";   }
        else {Label4->Caption="Правильно";   }
        if ((d>30) && (m>8) && (m%2==1)) Label4->Caption="Ошибка";
        else { Label4->Caption="Правильно";}
        if ((d>=1) || (d<=28) && (m==2) && (y%4==0)){ Label4->Caption="Правильно"; }
        else {Label4->Caption="Ошибка";   }
        if ((d<1) || (d>29) && (y%4==1)) { Label4->Caption="Ошибка"; }
        else { Label4->Caption="Правильно"; }
        }  break;
case 1: g=StrToInt(Edit2->Text);{
        if (g>=60)  Label4->Caption="Пожароопасно! Покиньте помещение!";
        else  {Label4->Caption="Всё в порядке:)";}
        if (g<-273)  Label4->Caption="Недопустимая температура! Введите корректное значение"; }
        break;
case 2: v=StrToInt(Edit2->Text);{
        if ((v>0) || (v<=3)) {Label4->Caption="Очень маленкий ребенок"; }
        if ((v>=4) || (v<7)) { Label4->Caption="Дошкольник"; }
        if ((v>=7) || (v<=23)) {Label4->Caption="Ученик"; }
        if ((v>=24) || (v<=60)){ Label4->Caption="Рабочий"; }
        if (v>=60) {Label4->Caption="Пенсионер";}  }
        break;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Label1->Hide();
Label2->Hide();
Label3->Hide();
Label4->Hide();
Edit1->Hide();
Edit2->Hide();
Edit3->Hide();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key)
{
if(IsCharAlpha(Key)) Key=0;
if(Key==VK_RETURN) {Button1->SetFocus();return;}        
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit2KeyPress(TObject *Sender, char &Key)
{
if(IsCharAlpha(Key)) Key=0;
if(Key==VK_RETURN) {Button1->SetFocus();return;}        
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit3KeyPress(TObject *Sender, char &Key)
{
if(IsCharAlpha(Key)) Key=0;
if(Key==VK_RETURN) {Button1->SetFocus();return;}        
}
//---------------------------------------------------------------------------


Соседние файлы в папке пр2_новая
  • #
    30.05.20203.74 Кб0Project1.bpr
  • #
    30.05.20201.07 Кб0Project1.cpp
  • #
    30.05.202017.82 Кб0Project1.obj
  • #
    30.05.2020876 б1Project1.res
  • #
    30.05.20203.01 Mб0Project1.tds
  • #
    30.05.20204.37 Кб0Unit1.cpp
  • #
    30.05.202051 б0Unit1.ddp
  • #
    30.05.20204.69 Кб1Unit1.dfm
  • #
    30.05.20201.49 Кб0Unit1.h
  • #
    30.05.202047.32 Кб0Unit1.obj
  • #
    30.05.20204.36 Кб0Unit1.~cpp