|
//-------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
USERES("Project1.res");
USEFORM("Unit1.cpp", Form1);
USEFORM("Unit2.cpp", AboutBox);
//-------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->CreateForm(__classid(TAboutBox), &AboutBox);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
//-------------------------------------------------------------------
UNIT1.H
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <Mask.hpp>
#include <Menus.hpp>
//---------------------------------------------------------------------------
class TForm1: public TForm
{
__published: // IDE-managed Components
TLabel *Label1;
TMaskEdit *MaskEdit1;
TSpeedButton *SpeedButton1;
TPanel *Panel1;
TImage *Image1;
TImage *Image2;
TImage *Image3;
TImage *Image4;
TImage *Image5;
TImage *Image6;
TImage *Image7;
TImage *Image8;
TImage *Image9;
TImage *Image10;
TImage *Image11;
TImage *Image12;
TImage *Image13;
TImage *Image14;
TImage *Image15;
TImage *Image16;
TImage *Image17;
TImage *Image18;
TImage *Image19;
TImage *Image20;
TImage *Image21;
TImage *Image22;
TImage *Image23;
TImage *Image24;
TImage *Image25;
TImage *Image26;
TImage *Image27;
TImage *Image28;
TImage *Image29;
TImage *Image30;
TImage *Image31;
TImage *Image32;
TImage *Image33;
TImage *Image34;
TImage *Image35;
TImage *Image36;
TImage *Image37;
TImage *Image38;
TImage *Image39;
TImage *Image40;
TImage *Image41;
TImage *Image42;
TImage *Image43;
TImage *Image44;
TImage *Image45;
TImage *Image46;
TImage *Image47;
TImage *Image48;
TImage *Image49;
TImage *Image50;
TImage *Image51;
TImage *Image52;
TImage *Image53;
TImage *Image54;
TImage *Image55;
TImage *Image56;
TImage *Image57;
TImage *Image58;
TImage *Image59;
TImage *Image60;
TImage *Image61;
TImage *Image62;
TImage *Image63;
TImage *Image64;
TImage *Image65;
TImage *Image66;
TImage *Image67;
TImage *Image68;
TImage *Image69;
TImage *Image70;
TImage *Image71;
TEdit *Edit1;
TLabel *Label2;
TLabel *Label3;
TLabel *Label4;
TLabel *Label5;
TLabel *Label6;
TLabel *Label7;
TLabel *Label8;
TLabel *Label9;
TLabel *Label10;
TMainMenu *MainMenu1;
TMenuItem *N1;
TMenuItem *N2;
TMenuItem *N3;
TMenuItem *N4;
void __fastcall SpeedButton1Click(TObject *Sender);
void __fastcall N4Click(TObject *Sender);
void __fastcall N3Click(TObject *Sender);
void __fastcall N2Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
UNIT1.CPP
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
short Tabl[10][7]=
{ {0,0,0,1,0,0,1},
{0,0,1,0,0,0,1},
{0,0,1,0,1,1,1},
{0,0,1,1,0,1,1},
{0,0,1,1,1,0,1},
{0,1,0,0,1,1,1},
{0,1,0,1,0,1,1},
{0,1,0,1,1,0,1},
{0,1,1,0,0,1,1},
{0,1,1,0,1,0,1}};
short CheckTabl[56][6]=
{
{1,1,1,1,1,1}, //*
{0,0,0,0,0,0},
{1,0,0,0,0,0},
{0,1,0,0,0,0},//1
{0,0,1,0,0,0},
{0,0,0,1,0,0},
{1,1,1,1,1,1}, //*
{1,1,1,1,1,1}, //*
{0,0,0,0,1,0},
{0,0,0,0,0,1},
{1,1,0,0,0,0},//2
{1,0,1,0,0,0},
{1,0,0,1,0,0},
{1,1,1,1,1,1}, //*
{1,1,1,1,1,1}, //*
{1,0,0,0,1,0},
{1,0,0,0,0,1},
{0,1,1,0,0,0},//3
{0,1,0,1,0,0},
{0,1,0,0,1,0},
{1,1,1,1,1,1}, //*
{1,1,1,1,1,1}, //*
{0,1,0,0,0,1},
{0,0,1,1,0,0},
{0,0,1,0,1,0},//4
{0,0,1,0,0,1},
{0,0,0,1,1,0},
{1,1,1,1,1,1}, //*
{1,1,1,1,1,1}, //*
{0,0,0,1,0,1},
{0,0,0,0,1,1},
{1,1,1,0,0,0},//5
{1,1,0,1,0,0},
{1,1,0,0,1,0},
{1,1,1,1,1,1}, //*
{1,1,1,1,1,1}, //*
{1,1,0,0,0,1},
{1,0,1,1,0,0},
{1,0,1,0,1,0},//6
{1,0,1,0,0,1},
{1,0,0,1,1,0},
{1,1,1,1,1,1}, //*
{1,1,1,1,1,1}, //*
{1,0,0,1,0,1},
{1,0,0,0,1,1},
{0,1,1,1,0,0},//7
{0,1,1,0,1,0},
{0,1,1,0,0,1},
{1,1,1,1,1,1}, //*
{1,1,1,1,1,1}, //*
{0,1,0,1,1,0},
{0,1,0,1,0,1},
{0,1,0,0,1,1},//8
{0,0,1,1,1,0},
{0,0,1,1,0,1},
{1,1,1,1,1,1}, //*
};
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
char *Buffer = new char[9]; //Creates Buffer dynamic variable
int CodeInt[8];
char MyCode[8];
char MasBit[71];
Form1->MaskEdit1->GetTextBuf(Buffer,8);
for(int i=0;i<7;i++) MyCode[i]=Buffer[i];
for(int i=0;i<7;i++) CodeInt[i]=MyCode[i]-48;
CodeInt[7]=(CodeInt[0]+CodeInt[2]+CodeInt[4]+CodeInt[6]+3*(CodeInt[1]+CodeInt[3]+CodeInt[5]))%10;
MyCode[7]=CodeInt[7]+48;
Form1->Label3->Caption=Buffer[0];
Form1->Label4->Caption=Buffer[1];
Form1->Label5->Caption=Buffer[2];
Form1->Label6->Caption=Buffer[3];
Form1->Label7->Caption=Buffer[4];
Form1->Label8->Caption=Buffer[5];
Form1->Label9->Caption=Buffer[6];
Form1->Label10->Caption=MyCode[7];
Form1->Edit1->Text=MyCode[7];
unsigned int s; //
short TmpMas[6];
for(int i=0;i<8;i++)
{
for(int j=0;j<7;j++)
{
MasBit[i*7+j]=Tabl[(CodeInt[i])][j];
};
};
for(int i=0;i<6;i++)
{
s=0;
for(int j=0;j<56;j++)
{
if(CheckTabl[j][i]==0)
{
s+=MasBit[j];
};
};
TmpMas[i]=s%2;
};
MasBit[56]=0;
MasBit[57]=1;
MasBit[58]=TmpMas[0];
MasBit[59]=TmpMas[1];
MasBit[60]=0;
MasBit[61]=1;
MasBit[62]=TmpMas[2];
MasBit[63]=TmpMas[3];
MasBit[64]=0;
MasBit[65]=1;
MasBit[66]=TmpMas[4];
MasBit[67]=TmpMas[5];
MasBit[68]=0;
MasBit[69]=1;
MasBit[70]=0;
if (MasBit[0]==0) Form1->Image1->Visible=true;
else Form1->Image1->Visible=false;
if (MasBit[1]==0) Form1->Image2->Visible=true;
else Form1->Image2->Visible=false;
if (MasBit[2]==0) Form1->Image3->Visible=true;
else Form1->Image3->Visible=false;
if (MasBit[3]==0) Form1->Image4->Visible=true;
else Form1->Image4->Visible=false;
if (MasBit[4]==0) Form1->Image5->Visible=true;
else Form1->Image5->Visible=false;
if (MasBit[5]==0) Form1->Image6->Visible=true;
else Form1->Image6->Visible=false;
if (MasBit[6]==0) Form1->Image7->Visible=true;
else Form1->Image7->Visible=false;
if (MasBit[7]==0) Form1->Image8->Visible=true;
else Form1->Image8->Visible=false;
if (MasBit[8]==0) Form1->Image9->Visible=true;
else Form1->Image9->Visible=false;
if (MasBit[9]==0) Form1->Image10->Visible=true;
else Form1->Image10->Visible=false;
if (MasBit[10]==0) Form1->Image11->Visible=true;
else Form1->Image11->Visible=false;
if (MasBit[11]==0) Form1->Image12->Visible=true;
else Form1->Image12->Visible=false;
if (MasBit[12]==0) Form1->Image13->Visible=true;
else Form1->Image13->Visible=false;
if (MasBit[13]==0) Form1->Image14->Visible=true;
else Form1->Image14->Visible=false;
if (MasBit[14]==0) Form1->Image15->Visible=true;
else Form1->Image15->Visible=false;
if (MasBit[15]==0) Form1->Image16->Visible=true;
else Form1->Image16->Visible=false;
if (MasBit[16]==0) Form1->Image17->Visible=true;
else Form1->Image17->Visible=false;
if (MasBit[17]==0) Form1->Image18->Visible=true;
else Form1->Image18->Visible=false;
if (MasBit[18]==0) Form1->Image19->Visible=true;
else Form1->Image19->Visible=false;
if (MasBit[19]==0) Form1->Image20->Visible=true;
else Form1->Image20->Visible=false;
if (MasBit[20]==0) Form1->Image21->Visible=true;
else Form1->Image21->Visible=false;
if (MasBit[21]==0) Form1->Image22->Visible=true;
else Form1->Image22->Visible=false;
if (MasBit[22]==0) Form1->Image23->Visible=true;
else Form1->Image23->Visible=false;
if (MasBit[23]==0) Form1->Image24->Visible=true;
else Form1->Image24->Visible=false;
if (MasBit[24]==0) Form1->Image25->Visible=true;
else Form1->Image25->Visible=false;
if (MasBit[25]==0) Form1->Image26->Visible=true;
else Form1->Image26->Visible=false;
if (MasBit[26]==0) Form1->Image27->Visible=true;
else Form1->Image27->Visible=false;
if (MasBit[27]==0) Form1->Image28->Visible=true;
else Form1->Image28->Visible=false;
if (MasBit[28]==0) Form1->Image29->Visible=true;
else Form1->Image29->Visible=false;
if (MasBit[29]==0) Form1->Image30->Visible=true;
else Form1->Image30->Visible=false;
if (MasBit[30]==0) Form1->Image31->Visible=true;
else Form1->Image31->Visible=false;
if (MasBit[31]==0) Form1->Image32->Visible=true;
else Form1->Image32->Visible=false;
if (MasBit[32]==0) Form1->Image33->Visible=true;
else Form1->Image33->Visible=false;
if (MasBit[33]==0) Form1->Image34->Visible=true;
else Form1->Image34->Visible=false;
if (MasBit[34]==0) Form1->Image35->Visible=true;
else Form1->Image35->Visible=false;
if (MasBit[35]==0) Form1->Image36->Visible=true;
else Form1->Image36->Visible=false;
if (MasBit[36]==0) Form1->Image37->Visible=true;
else Form1->Image37->Visible=false;
if (MasBit[37]==0) Form1->Image38->Visible=true;
else Form1->Image38->Visible=false;
if (MasBit[38]==0) Form1->Image39->Visible=true;
else Form1->Image39->Visible=false;
if (MasBit[39]==0) Form1->Image40->Visible=true;
else Form1->Image40->Visible=false;
if (MasBit[40]==0) Form1->Image41->Visible=true;
else Form1->Image41->Visible=false;
if (MasBit[41]==0) Form1->Image42->Visible=true;
else Form1->Image42->Visible=false;
if (MasBit[42]==0) Form1->Image43->Visible=true;
else Form1->Image43->Visible=false;
if (MasBit[43]==0) Form1->Image44->Visible=true;
else Form1->Image44->Visible=false;
if (MasBit[44]==0) Form1->Image45->Visible=true;
else Form1->Image45->Visible=false;
if (MasBit[45]==0) Form1->Image46->Visible=true;
else Form1->Image46->Visible=false;
if (MasBit[46]==0) Form1->Image47->Visible=true;
else Form1->Image47->Visible=false;
if (MasBit[47]==0) Form1->Image48->Visible=true;
else Form1->Image48->Visible=false;
if (MasBit[48]==0) Form1->Image49->Visible=true;
else Form1->Image49->Visible=false;
if (MasBit[49]==0) Form1->Image50->Visible=true;
else Form1->Image50->Visible=false;
if (MasBit[50]==0) Form1->Image51->Visible=true;
else Form1->Image51->Visible=false;
if (MasBit[51]==0) Form1->Image52->Visible=true;
else Form1->Image52->Visible=false;
if (MasBit[52]==0) Form1->Image53->Visible=true;
else Form1->Image53->Visible=false;
if (MasBit[53]==0) Form1->Image54->Visible=true;
else Form1->Image54->Visible=false;
if (MasBit[54]==0) Form1->Image55->Visible=true;
else Form1->Image55->Visible=false;
if (MasBit[55]==0) Form1->Image56->Visible=true;
else Form1->Image56->Visible=false;
if (MasBit[56]==0) Form1->Image57->Visible=true;
else Form1->Image57->Visible=false;
if (MasBit[57]==0) Form1->Image58->Visible=true;
else Form1->Image58->Visible=false;
if (MasBit[58]==0) Form1->Image59->Visible=true;
else Form1->Image59->Visible=false;
if (MasBit[59]==0) Form1->Image60->Visible=true;
else Form1->Image60->Visible=false;
if (MasBit[60]==0) Form1->Image61->Visible=true;
else Form1->Image61->Visible=false;
if (MasBit[61]==0) Form1->Image62->Visible=true;
else Form1->Image62->Visible=false;
if (MasBit[62]==0) Form1->Image63->Visible=true;
else Form1->Image63->Visible=false;
if (MasBit[63]==0) Form1->Image64->Visible=true;
else Form1->Image64->Visible=false;
if (MasBit[64]==0) Form1->Image65->Visible=true;
else Form1->Image65->Visible=false;
if (MasBit[65]==0) Form1->Image66->Visible=true;
else Form1->Image66->Visible=false;
if (MasBit[66]==0) Form1->Image67->Visible=true;
else Form1->Image67->Visible=false;
if (MasBit[67]==0) Form1->Image68->Visible=true;
else Form1->Image68->Visible=false;
if (MasBit[68]==0) Form1->Image69->Visible=true;
else Form1->Image69->Visible=false;
if (MasBit[69]==0) Form1->Image70->Visible=true;
else Form1->Image70->Visible=false;
if (MasBit[70]==0) Form1->Image71->Visible=true;
else Form1->Image71->Visible=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N4Click(TObject *Sender)
{
Form1->SpeedButton1->Click();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N3Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N2Click(TObject *Sender)
{
AboutBox->ShowModal();
}
//---------------------------------------------------------------------------
UNIT2.H
//----------------------------------------------------------------------------
#ifndef Unit2H
#define Unit2H
//----------------------------------------------------------------------------
#include <vcl\System.hpp>
#include <vcl\Windows.hpp>
#include <vcl\SysUtils.hpp>
#include <vcl\Classes.hpp>
#include <vcl\Graphics.hpp>
#include <vcl\Forms.hpp>
#include <vcl\Controls.hpp>
#include <vcl\StdCtrls.hpp>
#include <vcl\Buttons.hpp>
#include <vcl\ExtCtrls.hpp>
//----------------------------------------------------------------------------
class TAboutBox: public TForm
{
__published:
TPanel *Panel1;
TImage *ProgramIcon;
TLabel *ProductName;
TLabel *Version;
TLabel *Copyright;
TLabel *Comments;
TButton *OKButton;
private:
public:
virtual __fastcall TAboutBox(TComponent* AOwner);
};
//----------------------------------------------------------------------------
extern PACKAGE TAboutBox *AboutBox;
//----------------------------------------------------------------------------
#endif
Дата добавления: 2015-07-21; просмотров: 36 | Нарушение авторских прав
<== предыдущая страница | | | следующая страница ==> |
MOONBUG.BPR | | | PROJECT1.BPR |