Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Університет “Україна” ЗКС52.35-14Б.doc
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
1.12 Mб
Скачать

Проект MoonBug

Програма для генерування помилок їх ваявлення та виправлення. Має більш дружній інтерфейс користувача створений на основі Win32 в середовищі Borland C++ Builder4.0. Програма виводить результати тесту в наочний графік.

MOONBUG.CPP

//------------------------------------------------------------------------

#include <vcl.h>

#include "Barclass.h"

#pragma hdrstop

USERES("MoonBug.res");

USEFORM("Unit1.cpp", Form1);

USEFILE("BarClass.h");

USEUNIT("Barclass.cpp");

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 <ExtCtrls.hpp>

#include <Dialogs.hpp>

#include <Menus.hpp>

#include <ActnList.hpp>

#include <ComCtrls.hpp>

#include <StdActns.hpp>

#include <ToolWin.hpp>

#include <Mask.hpp>

#include <Buttons.hpp>

#include <Chart.hpp>

#include <DBChart.hpp>

#include <Series.hpp>

#include <TeeFunci.hpp>

#include <TeEngine.hpp>

#include <TeeProcs.hpp>

#include "Unit2.h"

//------------------------------------------------------------------------

class TForm1 : public TForm

{

__published: // IDE-managed Components

TOpenDialog *OpenDialog1;

TMainMenu *MainMenu1;

TMenuItem *N1;

TMenuItem *N2;

TMenuItem *N3;

TMenuItem *N4;

TMenuItem *N5;

TMenuItem *N6;

TStatusBar *StatusBar1;

TActionList *ActionList1;

TEditCopy *EditCopy1;

TAction *Action1;

TAction *Action2;

TSaveDialog *SaveDialog1;

TPanel *Panel1;

TLabel *Label1;

TMaskEdit *MaskEdit1;

TCheckBox *CheckBox1;

TPanel *Panel2;

TCheckBox *CheckBox2;

TComboBox *ComboBoxErr;

TBitBtn *Stop;

TBitBtn *Start;

TBitBtn *BitBtn1;

TTimer *Timer1;

TTrackBar *TrackBar1;

TChart *Chart1;

TPieSeries *Series1;

TEdit *TextTimer;

TLabel *Label2;

TGroupBox *GroupBox1;

TEdit *Edit1Gen;

TLabel *Label3;

TLabel *Label4;

TEdit *Edit2war;

TLabel *Label5;

TEdit *Edit3notfatal;

TLabel *Label6;

TEdit *Edit4fatal;

TLabel *Label7;

void __fastcall FormInfo();

void __fastcall N2Click(TObject *Sender);

void __fastcall ButtonStartClick(TObject *Sender);

void __fastcall N4Click(TObject *Sender);

void __fastcall MaskEdit1Exit(TObject *Sender);

void __fastcall ComboBoxErrExit(TObject *Sender);

void __fastcall MaskEdit1Change(TObject *Sender);

void __fastcall StopClick(TObject *Sender);

void __fastcall BitBtn1Click(TObject *Sender);

void __fastcall Timer1Timer(TObject *Sender);

void __fastcall TrackBar1Change(TObject *Sender);

void __fastcall N5Click(TObject *Sender);

void __fastcall N6Click(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 "Barclass.h"

//--------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TBarCode* MyBarCode = new(TBarCode);

TForm1 *Form1;

//----------------------------------------------------------------------

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

}

//------------------------------------------------------------------------

void __fastcall TForm1::N2Click(TObject *Sender)

{

if(Form1->N2->Checked==false)

{

Form1->N2->Checked=true;

Form1->N3->Checked=false;

}

else

{

Form1->N2->Checked=false;

Form1->N3->Checked=true;

}

}

//------------------------------------------------------------------------

void __fastcall TForm1::ButtonStartClick(TObject *Sender)

{

if (Form1->N2->Checked==true)

{

// OpenDialog1->Execute();

Form1->MaskEdit1->Enabled=true;

Form1->MaskEdit1->ParentColor=false;

Form1->MaskEdit1->Color=clWhite;

Form1->Start->Enabled=false;

Form1->MaskEdit1->TabOrder=0;

Form1->ActiveControl=MaskEdit1;

}

else

{

};

}

//------------------------------------------------------------------------

void __fastcall TForm1::N4Click(TObject *Sender)

{

if (SaveDialog1->Execute()) Close();

}

//----------------------------------------------------------------------

void __fastcall TForm1::MaskEdit1Exit(TObject *Sender)

{

Form1->MaskEdit1->Enabled=false;

char *Buffer = new char[9]; //Creates Buffer dynamic variable

Form1->MaskEdit1->GetTextBuf(Buffer,8);

MyBarCode->SetUp(Buffer);

Form1->MaskEdit1->ParentColor=true;

Form1->CheckBox1->Checked=true;

Form1->ComboBoxErr->Enabled=true;

}

//------------------------------------------------------------------------

void __fastcall TForm1::ComboBoxErrExit(TObject *Sender)

{

Form1->ComboBoxErr->Enabled=false;

Form1->CheckBox2->Checked=true;

MyBarCode->SetCountErr(StrToInt(Form1->ComboBoxErr->Text));

}

//-----------------------------------------------------------------------

void __fastcall TForm1::MaskEdit1Change(TObject *Sender)

{

Form1->ComboBoxErr->Enabled=true;

}

//------------------------------------------------------------------------

void __fastcall TForm1::StopClick(TObject *Sender)

{

Form1->Timer1->Enabled=false;

Form1->Start->Enabled=true;

Form1->Chart1->Visible=false;

}

//------------------------------------------------------------------------

void __fastcall TForm1::BitBtn1Click(TObject *Sender)

{

Form1->Timer1->Enabled=true;

Form1->Chart1->Visible=true;

}

//-----------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender)

{

Form1->TextTimer->Text=IntToStr(MyBarCode->Pausa);

Form1->Timer1->Enabled=false;

MyBarCode->Test();

if (MyBarCode->Pausa==0)

{

Form1->FormInfo();

MyBarCode->Info();

MyBarCode->Pausa=Form1->TrackBar1->Position*100;

}

else

{

};

MyBarCode->Pausa--;

Form1->Timer1->Enabled=true;

}

//-----------------------------------------------------------------------

void __fastcall TForm1::TrackBar1Change(TObject *Sender)

{

MyBarCode->Pausa=Position*100;

}

//-----------------------------------------------------------------------

//-----------------------------------------------------------------------

void __fastcall TForm1::FormInfo()

{

int pf,pn,pw;

pf=(MyBarCode->GetCountErr(1)*100)/MyBarCode->GetCountErr(0);

pn=(MyBarCode->GetCountErr(2)*100)/MyBarCode->GetCountErr(0);

pw=(MyBarCode->GetCountErr(3)*100)/MyBarCode->GetCountErr(0);

Form1->Chart1->Visible=true;

Series1->Clear();

Series1->ExplodeBiggest;

Series1->AddPie( pf, "% тш тыхэю" , clRed ) ;

Series1->AddPie( pn, "% тшяЁртыхэю", clBlue ) ;

Series1->AddPie( pw, "% эх тш тыхэю", clGreen ) ;

Form1->Edit1Gen->Text=FloatToStr(MyBarCode->GetCountErr(0));

Form1->Edit2war->Text=FloatToStr(MyBarCode->GetCountErr(3));

Form1->Edit3notfatal->Text=FloatToStr(MyBarCode->GetCountErr(2));

Form1->Edit4fatal->Text=FloatToStr(MyBarCode->GetCountErr(1));

};

void __fastcall TForm1::N5Click(TObject *Sender)

{

Form1->FormInfo();

}

//----------------------------------------------------------------------

void __fastcall TForm1::N6Click(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

UNIT2.CPP

//--------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit2.h"

//---------------------------------------------------------------------

#pragma resource "*.dfm"

TAboutBox *AboutBox;

//---------------------------------------------------------------------

__fastcall TAboutBox::TAboutBox(TComponent* AOwner)

: TForm(AOwner)

{

}

//---------------------------------------------------------------------

BARCLASS.H

class TBarCode {

private:

char MyCode[8];

int CodeInt[8];

int CountErr;

char MasBit[71];

char ErrBit[71];

double CountGenErr;

double FatalErr;

double NotFatal;

double WarnErr;

void CheckSum();

void CreatBitCode();

bool Next();

void GenError();

void Control();

// double Error;

// double FatalErr;

// double NotFatalError;

// ¦юф •ю ъюфє¦Є№ё 

/* unsigned char pcode[8];

unsigned char textdata[25];

char cod[8];

char flag;

char f1;

char f2;

char masbit[71];

char errbit[71];

unsigned char ecode[8];

double err;

double ferr;

double nferr;

double warning;

*/

public: TBarCode();

void SetUp(char*);

void Test();

void SetCountErr(int);

double GetCountErr(int);

void Info();

int Pausa;

/* void bitcode();

void checksum();

void init(char*,char);

void getmytime();

void save(char*,BarCode*);

void read(char*,BarCode*);

short next();

void test();

void info();

void gen_error();

*/

};

BARCLASS.CPP

#include "Barclass.h"

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}, //*

};

//-----------------------------------

void TBarCode::SetUp(char* Text)

{

for(int i=0;i<7;i++) MyCode[i]=Text[i];

}

//------------------------------------

TBarCode::TBarCode()

{

Pausa=500;

}

//------------------------------------

void TBarCode::Test()

{

// SetCountErr();

CheckSum();

CreatBitCode();

GenError();

}

//-----------------------------------

void TBarCode::CheckSum() //+

{

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;

}

//------------------------------------

void TBarCode::CreatBitCode()

{

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;

for(int i=0;i<71;i++) ErrBit[i]=MasBit[i];

}

// T CodeInt[8] 8-ьш чэрўэх ўшёыю

// чс¦ы№°шью щюую эр юфшэшЎ¦

// T Ёрч¦  ъ•ю ўшёыю фюё уыю 99999999 яютхЁЄр¦Є№ё  чэрўхээ  true.

bool TBarCode::Next()

{

if(CodeInt[6]!=9) { CodeInt[6]++; MyCode[6]++;}

else

{

if(CodeInt[5]!=9) { CodeInt[5]++; MyCode[5]++; }

else

{

if(CodeInt[4]!=9) {CodeInt[4]++;MyCode[4]++;}

else

{

if(CodeInt[3]!=9) {CodeInt[3]++;MyCode[3]++;}

else

{

if(CodeInt[2]!=9) {CodeInt[2]++;MyCode[2]++;}

else

{

if(CodeInt[1]!=9) {CodeInt[1]++;MyCode[1]++;}

else

{

if(CodeInt[0]!=9) {CodeInt[0]++;MyCode[0]++;}

else return(false);

CodeInt[1]=0;

MyCode[1]='0';

};

CodeInt[2]=0;

MyCode[2]='0';

};

CodeInt[3]=0;

MyCode[3]='0';

};

CodeInt[4]=0;

MyCode[4]='0';

};

CodeInt[5]=0;

MyCode[5]='0';

};

CodeInt[6]=0;

MyCode[6]='0';

};

return(true);

}

//------------------------------------

void TBarCode::SetCountErr(int Err) { CountErr=Err; }

//--------------------------------------------------

double TBarCode::GetCountErr(int TypeErr)

{

switch (TypeErr) {

case 0: return(CountGenErr);break;

case 1: return(FatalErr);break;

case 2: return(NotFatal);break;

case 3: return(WarnErr);break;

default: return(0);

}

}

//--------------------------------------------------

void TBarCode::GenError()

{

int f1,f2;

if(CountErr==1)

{

f1=1;

do

{

if(ErrBit[f1]==0) ErrBit[f1]=1;

else if(ErrBit[f1]==1) ErrBit[f1]=0;

Control();

if(ErrBit[f1]==0) ErrBit[f1]=1;

else if(ErrBit[f1]==1) ErrBit[f1]=0;

f1++;

} while(f1<72);

};

if(CountErr==2)

{

f1=1;

do

{

f2=f1+1;

do

{

if(ErrBit[f1]==0) ErrBit[f1]=1;

else if(ErrBit[f1]==1) ErrBit[f1]=0;

if(ErrBit[f2]==0) ErrBit[f2]=1;

else if(ErrBit[f2]==1) ErrBit[f2]=0;

Control();

if(ErrBit[f1]==0) ErrBit[f1]=1;

else if(ErrBit[f1]==1) ErrBit[f1]=0;

if(ErrBit[f2]==0) ErrBit[f2]=1;

else if(ErrBit[f2]==1) ErrBit[f2]=0;

f2++;

} while(f2<72);

f1++;

} while(f1<71);

};

}

//----------------------------------------------------

void TBarCode::Info() //+

{

}

//-----------------------------------

void TBarCode::Control()

{

unsigned char ErrCode[8];

short TmpMas[6];

short i,j,s;

short Check[6]={1,1,1,1,1,1};

char TestCod[8];

char Test[71];

char TestTab[7];

CountGenErr++;

for(i=0;i<71;i++)

Test[i]=ErrBit[i];

for(i=0;i<8;i++)

{

Test[i*7]=0; //

Test[i*7+6]=1; //

}; //

Test[56]=0; //

Test[57]=1; //

Test[60]=0; //

Test[61]=1; //

Test[64]=0; //

Test[65]=1; //

Test[68]=0; //

Test[69]=1; //

Test[70]=0; //

for(i=0;i<6;i++) //

{

s=0;

for(j=0;j<56;j++)

{

if(CheckTabl[j][i]==0)

{

s+=Test[j];

};

};

TmpMas[i]=s%2;

};

for(j=0;j<3;j++)

{

if(TmpMas[j*2]!=Test[58+j*4]) Check[j*2]=0;

if(TmpMas[j*2+1]!=Test[59+j*4]) Check[j*2+1]=0;

};

short n=0;

for(i=0;i<6;i++)

{

if(Check[i]==0)

{

n++;

};

};

if(n>1) n=0;

else n=1;

switch (n)

{

case 0:

{

for(i=0;i<56;i++)

{

short eq=1;

for(j=0;j<6;j++)

{

if(Check[j]!=CheckTabl[i][j]) //

{

eq=0;

break;

};

};

if(eq==1)

{

if(Test[i]==1) Test[i]=0;

else Test[i]=1;

break;

};

};

};

case 1: //

{

for(i=0;i<8;i++)

{

for(j=0;j<7;j++)

{

TestTab[j]=Test[i*7+j];

};

short eq2;

for(j=0;j<10;j++)

{

short eq=1;

eq2=0;

for(s=0;s<7;s++)

{

if(TestTab[s]!=Tabl[j][s])

{

eq=0;

break;

};

};

if(eq==1)

{

TestCod[i]=j;

eq2=1;

break;

}

};

if(eq2==0)

{

FatalErr++;

return;

}

};

short t;

t=(TestCod[0]+TestCod[2]+TestCod[4]+TestCod[6]+3*(TestCod[1]+TestCod[3]+TestCod[5]))%10;

if(t!=TestCod[7])

{

FatalErr++;

return;

};

for(i=0;i<8;i++)

{

if(TestCod[i]!=CodeInt[i])

{

for(j=0;j<8;j++) ErrCode[j]=TestCod[j]+48;

WarnErr++;

// info();

return;

};

};

NotFatal++;

return;

};

};

}

MOONBUG.BPR

# -----------------------------------------------------------------------

!if !$d(BCB)

BCB = $(MAKEDIR)\..

!endif

# ---------------------------------------------------------------------

# IDE SECTION

# -----------------------------------------------------------------------

# The following section of the project makefile is managed by the BCB IDE.

# It is recommended to use the IDE to change any of the values in this

# section.

# ------------------------------------------------------------------------

VERSION = BCB.04.04

# ------------------------------------------------------------------------

PROJECT = MoonBug.exe

OBJFILES = MoonBug.obj Unit1.obj Barclass.obj Unit2.obj

RESFILES = MoonBug.res

RESDEPEN = $(RESFILES) Unit1.dfm Unit2.dfm

LIBFILES =

LIBRARIES =

SPARELIBS = VCL40.lib TEEDB40.lib Tee40.lib QRpt40.lib VclDb40.lib

PACKAGES = VCL40.bpi VCLX40.bpi VCLJPG40.bpi bcbsmp40.bpi QRPT40.bpi VCLDB40.bpi \

ibsmp40.bpi VCLDBX40.bpi TEEUI40.bpi TEEDB40.bpi TEE40.bpi nmfast40.bpi \

dclocx40.bpi

DEFFILE =

# ------------------------------------------------------------------------

PATHCPP = .;

PATHPAS = .;

PATHASM = .;

PATHRC = .;

DEBUGLIBPATH = $(BCB)\lib\debug

RELEASELIBPATH = $(BCB)\lib\release

USERDEFINES =

SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES

# -----------------------------------------------------------------------

CFLAG1 = -I"D:\Program Files\Borland\CBuilder4\Projects";"D:\Program Files\Borland\CBuilder4\Projects\";$(BCB)\include;$(BCB)\include\vcl \

-Od -Hc -H=$(BCB)\lib\vcl40.csm -w -Ve -r- -a8 -k -y -v -vi- -c -b- -w-par \

-w-inl -Vx -tW -tWM -D$(SYSDEFINES);$(USERDEFINES)

PFLAGS = -U"D:\Program Files\Borland\CBuilder4\Projects";"d:\program files\borland\cbuilder4\Lib";"d:\program files\borland\cbuilder4\Lib\";"D:\Program Files\Borland\CBuilder4\Projects\";$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \

-I"D:\Program Files\Borland\CBuilder4\Projects";"D:\Program Files\Borland\CBuilder4\Projects\";$(BCB)\include;$(BCB)\include\vcl \

-$YD -$W -$O- -v -JPHNE -M

RFLAGS = -i"D:\Program Files\Borland\CBuilder4\Projects";"D:\Program Files\Borland\CBuilder4\Projects\";$(BCB)\include;$(BCB)\include\vcl

AFLAGS = /i"D:\Program Files\Borland\CBuilder4\Projects" \

/i"D:\Program Files\Borland\CBuilder4\Projects\" /i$(BCB)\include \

/i$(BCB)\include\vcl /mx /w2 /zd

LFLAGS = -L"D:\Program Files\Borland\CBuilder4\Projects";"d:\program files\borland\cbuilder4\Lib";"d:\program files\borland\cbuilder4\Lib\";"D:\Program Files\Borland\CBuilder4\Projects\";$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \

-aa -Tpe -x -Gn -v

# ------------------------------------------------------------------------

ALLOBJ = c0w32.obj Memmgr.Lib $(PACKAGES) sysinit.obj $(OBJFILES)

ALLRES = $(RESFILES)

ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib

# -----------------------------------------------------------------------

!ifdef IDEOPTIONS

[Version Info]

IncludeVerInfo=0

AutoIncBuild=0

MajorVer=1

MinorVer=0

Release=0

Build=0

Debug=0

PreRelease=0

Special=0

Private=0

DLL=0

Locale=1049

CodePage=1251

[Version Info Keys]

CompanyName=

FileDescription=

FileVersion=1.0.0.0

InternalName=

LegalCopyright=

LegalTrademarks=

OriginalFilename=

ProductName=

ProductVersion=1.0.0.0

Comments=

[Debugging]

DebugSourceDirs=$(BCB)\source\vcl

[Parameters]

RunParams=

HostApplication=

RemoteHost=

RemotePath=

RemoteDebug=0

[Compiler]

InMemoryExe=0

ShowInfoMsgs=0

!endif

# ----------------------------------------------------------------------

# MAKE SECTION

# ------------------------------------------------------------------------

# This section of the project file is not used by the BCB IDE. It is for

# the benefit of building from the command-line using the MAKE utility.

# ------------------------------------------------------------------------

.autodepend

# ------------------------------------------------------------------------

!if !$d(BCC32)

BCC32 = bcc32

!endif

!if !$d(CPP32)

CPP32 = cpp32

!endif

!if !$d(DCC32)

DCC32 = dcc32

!endif

!if !$d(TASM32)

TASM32 = tasm32

!endif

!if !$d(LINKER)

LINKER = ilink32

!endif

!if !$d(BRCC32)

BRCC32 = brcc32

!endif

# ------------------------------------------------------------------------

!if $d(PATHCPP)

.PATH.CPP = $(PATHCPP)

.PATH.C = $(PATHCPP)

!endif

!if $d(PATHPAS)

.PATH.PAS = $(PATHPAS)

!endif

!if $d(PATHASM)

.PATH.ASM = $(PATHASM)

!endif

!if $d(PATHRC)

.PATH.RC = $(PATHRC)

!endif

# ------------------------------------------------------------------------

$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE)

$(BCB)\BIN\$(LINKER) @&&!

$(LFLAGS) +

$(ALLOBJ), +

$(PROJECT),, +

$(ALLLIB), +

$(DEFFILE), +

$(ALLRES)

!

# ------------------------------------------------------------------------

.pas.hpp:

$(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }

.pas.obj:

$(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }

.cpp.obj:

$(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }

.c.obj:

$(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }

.c.i:

$(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< }

.cpp.i:

$(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< }

.asm.obj:

$(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@

.rc.res:

$(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<

# ------------------------------------------------------------------------

Проект HEM-8

Ця програма створена для генерування штрихового коду типу

НЕМ-8. Має дружній інтерфейс користувача створений на основі Win32 в середовищі Borland C++ Builder4.0. Після ведення 7-ми значного коду вона відображає зовнішній вид штрихового коду.

PROJECT1.CPP

//-------------------------------------------------------------------

#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

UNIT2.CPP

//---------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit2.h"

//---------------------------------------------------------------------

#pragma resource "*.dfm"

TAboutBox *AboutBox;

//---------------------------------------------------------------------

__fastcall TAboutBox::TAboutBox(TComponent* AOwner)

: TForm(AOwner)

{

}

//---------------------------------------------------------------------

PROJECT1.BPR

# -------------------------------------------------------------------

!if !$d(BCB)

BCB = $(MAKEDIR)\..

!endif

# -------------------------------------------------------------------

# IDE SECTION

# -------------------------------------------------------------------

# The following section of the project makefile is managed by the BCB IDE.

# It is recommended to use the IDE to change any of the values in this

# section.

# -------------------------------------------------------------------

VERSION = BCB.04.04

# ---------------------------------------------------------------------------

PROJECT = Project1.exe

OBJFILES = Project1.obj Unit1.obj Unit2.obj

RESFILES = Project1.res

RESDEPEN = $(RESFILES) Unit1.dfm Unit2.dfm

LIBFILES =

LIBRARIES =

SPARELIBS = VCL40.lib

PACKAGES = VCL40.bpi VCLX40.bpi VCLJPG40.bpi bcbsmp40.bpi QRPT40.bpi VCLDB40.bpi \

ibsmp40.bpi VCLDBX40.bpi TEEUI40.bpi TEEDB40.bpi TEE40.bpi nmfast40.bpi \

dclocx40.bpi

DEFFILE =

# ---------------------------------------------------------------------------

PATHCPP = .;

PATHPAS = .;

PATHASM = .;

PATHRC = .;

DEBUGLIBPATH = $(BCB)\lib\debug

RELEASELIBPATH = $(BCB)\lib\release

USERDEFINES =

SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES

# ---------------------------------------------------------------------------

CFLAG1 = -I"D:\Program Files\Borland\CBuilder4\Projects";$(BCB)\include;$(BCB)\include\vcl \

-Od -Hc -H=$(BCB)\lib\vcl40.csm -w -Ve -r- -a8 -k -y -v -vi- -c -b- -w-par \

-w-inl -Vx -tW -tWM -D$(SYSDEFINES);$(USERDEFINES)

PFLAGS = -U"D:\Program Files\Borland\CBuilder4\Projects";$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \

-I"D:\Program Files\Borland\CBuilder4\Projects";$(BCB)\include;$(BCB)\include\vcl \

-$YD -$W -$O- -v -JPHNE -M

RFLAGS = -i"D:\Program Files\Borland\CBuilder4\Projects";$(BCB)\include;$(BCB)\include\vcl

AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zd

LFLAGS = -L"D:\Program Files\Borland\CBuilder4\Projects";$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \

-aa -Tpe -x -Gn -v

# ---------------------------------------------------------------------------

ALLOBJ = c0w32.obj Memmgr.Lib $(PACKAGES) sysinit.obj $(OBJFILES)

ALLRES = $(RESFILES)

ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib

# ---------------------------------------------------------------------------

!ifdef IDEOPTIONS

[Version Info]

IncludeVerInfo=0

AutoIncBuild=0

MajorVer=1

MinorVer=0

Release=0

Build=0

Debug=0

PreRelease=0

Special=0

Private=0

DLL=0

Locale=1049

CodePage=1251

[Version Info Keys]

CompanyName=

FileDescription=

FileVersion=1.0.0.0

InternalName=

LegalCopyright=

LegalTrademarks=

OriginalFilename=

ProductName=

ProductVersion=1.0.0.0

Comments=

[Debugging]

DebugSourceDirs=$(BCB)\source\vcl

[Parameters]

RunParams=

HostApplication=

RemoteHost=

RemotePath=

RemoteDebug=0

[Compiler]

InMemoryExe=0

ShowInfoMsgs=0

!endif

# ---------------------------------------------------------------------------

# MAKE SECTION

# ---------------------------------------------------------------------------

# This section of the project file is not used by the BCB IDE. It is for

# the benefit of building from the command-line using the MAKE utility.

# ---------------------------------------------------------------------------

.autodepend

# ---------------------------------------------------------------------------

!if !$d(BCC32)

BCC32 = bcc32

!endif

!if !$d(CPP32)

CPP32 = cpp32

!endif

!if !$d(DCC32)

DCC32 = dcc32

!endif

!if !$d(TASM32)

TASM32 = tasm32

!endif

!if !$d(LINKER)

LINKER = ilink32

!endif

!if !$d(BRCC32)

BRCC32 = brcc32

!endif

# ---------------------------------------------------------------------------

!if $d(PATHCPP)

.PATH.CPP = $(PATHCPP)

.PATH.C = $(PATHCPP)

!endif

!if $d(PATHPAS)

.PATH.PAS = $(PATHPAS)

!endif

!if $d(PATHASM)

.PATH.ASM = $(PATHASM)

!endif

!if $d(PATHRC)

.PATH.RC = $(PATHRC)

!endif

# ---------------------------------------------------------------------------

$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE)

$(BCB)\BIN\$(LINKER) @&&!

$(LFLAGS) +

$(ALLOBJ), +

$(PROJECT),, +

$(ALLLIB), +

$(DEFFILE), +

$(ALLRES)

!

# ---------------------------------------------------------------------------

.pas.hpp:

$(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }

.pas.obj:

$(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }

.cpp.obj:

$(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }

.c.obj:

$(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }

.c.i:

$(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< }

.cpp.i:

$(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< }

.asm.obj:

$(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@

.rc.res:

$(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<

# ---------------------------------------------------------------------------

Блок-схема алготитма

Проект KORAN(OLDKORAN)

Програма була створена в DOS середовищі, за допомогою компілятора Borland C++ 3.1. Основним призначенням є тестування коду – це генерування помилок їх виявлення та виправлення.

KORAN.H

#define N 1

unsigned stop;

char cCase='1';

char cvar;

char pstr1[8];

char* pStr="koran.krn ";

int iFile;

int ii;

void titul();

KORANCLASS.H

class BarCode {

private:

unsigned char pcode[8];

unsigned char textdata[25];

char cod[8];

char flag;

char f1;

char f2;

char masbit[71];

char errbit[71];

unsigned char ecode[8];

double err;

double ferr;

double nferr;

double warning;

public:

void bitcode();

void checksum();

void init(char*,char);

void getmytime();

void save(char*,BarCode*);

void read(char*,BarCode*);

short next();

void test();

void info();

void gen_error();

};

KORAN.CPP

#include <stdlib.h>

#include <bios.h>

#include <conio.h>

#include <io.h>

#include <string.h>

#include <iostream.h>

#include <dos.h>

#include <time.h>

#include "koran\koran.h"

#include "koran\krnclass.h"

void main()

{

BarCode bcode;//= new BarCode;;

do

{

titul();

bcode.getmytime();

cout<<"1. Beginn prufung\n";

cout<<"2. Fortsetzen prufung\n\n";

cout<<" ? ";

cCase=getch();

} while((cCase!='1')&(cCase!='2'));

switch (cCase)

{

case '1':

{

titul();

cout<<"Einfurst der Filename(*.krn): [ ]\b\b\b\b\b\b\b\b\b";

cin>>pStr;

strcat(pStr,".krn");

titul();

cout<<"Einfurst anfangs kode: [ ]\b\b\b\b\b\b\b\b";

cin>>pstr1;

do

{

cout<<"\nEinfurst der Anzahl fehler(1/2): [ ]\b\b";

cin>>cvar;

} while ((cvar!='2')&(cvar!='1'));

bcode.init(pstr1,cvar);

bcode.save(pStr,&bcode);

break;

}; // case '1'

case '2':

{

titul();

cout<<"Einfurst der Filename(*.krn): [ ]\b\b\b\b\b\b\b\b\b";

cin>>pStr;

strcat(pStr,".krn");

bcode.read(pStr,&bcode);

break;

}

}; // end of switch-case

int n=0;

int commandquit;

do

{

bcode.checksum();

bcode.bitcode();

bcode.gen_error();

bcode.info();

if(n++==100)

{

bcode.save(pStr,&bcode);

n=0;

};

if(_bios_keybrd(_KEYBRD_READY)) commandquit=getch();

stop=bcode.next(); // +

} while ((stop==1)&(commandquit!='q'));

bcode.save(pStr,&bcode);

return;

}

KORAN_PR.CPP

#include <conio.h>

#include <io.h>

#include <fstream.h>

#include <iostream.h>

#include "koran\krnclass.h"

#include <time.h>

#include <dos.h>

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}, //*

};

void titul()

{

clrscr();

cout<< "Der Diplomprojekt v.1.2 'Koran' Mishel Kozak\n\n";

}

//----------------------------------------------

//

// Methode fur Klasse

//

//----------------------------------------------

void BarCode::init(char* mas,char fl)

{

int i;

flag=fl;

f1=1;

f2=2;

for(i=0;i<7;i++)

{cod[i]=mas[i]-48;

pcode[i]=mas[i];

};

cod[7]=0;

err=0;

ferr=0;

nferr=0;

warning=0;

}

//----------------------------------------------

void BarCode::getmytime()

{

struct tm mytm;

struct time tt;

struct date dd;

char* sss;

gettime(&tt);

getdate(&dd);

mytm.tm_sec=0;

mytm.tm_wday=0;

mytm.tm_year=0;

mytm.tm_isdst=0;

mytm.tm_min=tt.ti_min;

mytm.tm_hour=tt.ti_hour;

mytm.tm_mday=dd.da_day;

mytm.tm_mon=dd.da_mon-1;

mytm.tm_year=dd.da_year-1900;

int ii,jj;

sss=asctime(&mytm);

for(ii=3,jj=0;jj<25;ii++,jj++)

textdata[jj]=sss[ii];

// textdata[jj++]='\n';

// textdata[jj++]='\0';

}

//----------------------------------------------

void BarCode::save(char* pstr,BarCode* bco)

{

ofstream rootf(pstr,ios::binary);

if(rootf)

{

rootf.write((char*)bco,sizeof(*bco));

// rootf.write((char*)&bcode,sizeof(bcode));

}

else

{

cout<<"Error open file: "<<pstr;

}

}

//----------------------------------------------

void BarCode::read(char* pstr,BarCode* bco)

{

ifstream rootf(pstr,ios::binary);

if(rootf)

{

rootf.read((char*)bco,sizeof(*bco));

}

else

{

cout<<"Error open file: "<<pstr;

}

}

//----------------------------------------------

void BarCode::checksum()

{

cod[7]=(cod[0]+cod[2]+cod[4]+cod[6]+3*(cod[1]+cod[3]+cod[5]))%10;

pcode[7]=cod[7]+48;

// titul();

// cout<<"\n Code: "<<pcode[0]<<" "<<pcode[1]<<" "<<pcode[2]<<" "<<pcode[3]<<" "<<pcode[4];

// cout<<" "<<pcode[5]<<" "<<pcode[6]<<" "<<pcode[7]<<"\n\n";

}

//----------------------------------------------

short BarCode::next()

{

if(cod[6]!=9) { cod[6]++; pcode[6]++;}

else

{

if(cod[5]!=9) { cod[5]++; pcode[5]++; }

else

{

if(cod[4]!=9) {cod[4]++;pcode[4]++;}

else

{

if(cod[3]!=9) {cod[3]++;pcode[3]++;}

else

{

if(cod[2]!=9) {cod[2]++;pcode[2]++;}

else

{

if(cod[1]!=9) {cod[1]++;pcode[1]++;}

else

{

if(cod[0]!=9) {cod[0]++;pcode[0]++;}

else return(0);

cod[1]=0;

pcode[1]='0';

};

cod[2]=0;

pcode[2]='0';

};

cod[3]=0;

pcode[3]='0';

};

cod[4]=0;

pcode[4]='0';

};

cod[5]=0;

pcode[5]='0';

};

cod[6]=0;

pcode[6]='0';

};

return(1);

}

//----------------------------------------------

void BarCode::info()

{

{

titul();

getmytime();

cout<<" "<<textdata;

cout<<"\n Code: "<<pcode[0]<<" "<<pcode[1]<<" "<<pcode[2]<<" "<<pcode[3]<<" "<<pcode[4];

cout<<" "<<pcode[5]<<" "<<pcode[6]<<" "<<pcode[7]<<"\n\n";

cout<<"\n Code: "<<ecode[0]<<" "<<ecode[1]<<" "<<ecode[2]<<" "<<ecode[3]<<" "<<ecode[4];

cout<<" "<<ecode[5]<<" "<<ecode[6]<<" "<<ecode[7]<<"\n\n";

cout<<"\n Type error: "<<flag;

int i;

cout<<"\n - 1- 1- 1- 1- 1- 1- 1- 1-1 -1 -1 -1-\n ";

cout<<"\n Real";

for(i=0;i<71;i++)

{

char ch;

if(masbit[i]==0) ch=219;

else ch=0;

cout<<ch;

};

cout<<"\nerror";

for(i=0;i<71;i++)

{

char ch;

if(errbit[i]==0) ch=219;

else ch=0;

cout<<ch;

};

cout<<"\n\n Total error: "<<err;

cout<<"\n = fatal error: "<<ferr<<" "<<ferr/(err/100)<<"%";

cout<<"\n = corectly error: "<<nferr<<" "<<nferr/(err/100)<<"%";

cout<<"\n = warning error: "<<warning<<" "<<warning/(err/100)<<"%";

cout<<"\n\n\n\n For exit press 'q'... ";

}

}

//----------------------------------------------

void BarCode::bitcode()

{

unsigned int i,j,s;

short tmpmas[6];

for(i=0;i<8;i++)

{

for(j=0;j<7;j++)

{

masbit[i*7+j]=tabl[(cod[i])][j];

};

};

for(i=0;i<6;i++)

{

s=0;

for(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;

for(i=0;i<71;i++) errbit[i]=masbit[i];

}

//------------------------------------------

void BarCode::gen_error()

{

if(flag=='1')

{

f1=1;

do

{

if(errbit[f1]==0) errbit[f1]=1;

else if(errbit[f1]==1) errbit[f1]=0;

test();

if(errbit[f1]==0) errbit[f1]=1;

else if(errbit[f1]==1) errbit[f1]=0;

f1++;

} while(f1<72);

};

if(flag=='2')

{

f1=1;

do

{

f2=f1+1;

do

{

if(errbit[f1]==0) errbit[f1]=1;

else if(errbit[f1]==1) errbit[f1]=0;

if(errbit[f2]==0) errbit[f2]=1;

else if(errbit[f2]==1) errbit[f2]=0;

test();

if(errbit[f1]==0) errbit[f1]=1;

else if(errbit[f1]==1) errbit[f1]=0;

if(errbit[f2]==0) errbit[f2]=1;

else if(errbit[f2]==1) errbit[f2]=0;

f2++;

} while(f2<72);

f1++;

} while(f1<71);

};

}

//----------------------------------------------

void BarCode::test()

{

short tmpmas[6];

short i,j,s;

short check[6]={1,1,1,1,1,1};

char testcod[8];

char test[71];

char testtab[7];

err++;

for(i=0;i<71;i++)

test[i]=errbit[i];

for(i=0;i<8;i++)

{

test[i*7]=0;

test[i*7+6]=1;

};

test[56]=0;

test[57]=1;

test[60]=0;

test[61]=1;

test[64]=0;

test[65]=1;

test[68]=0;

test[69]=1;

test[70]=0;

for(i=0;i<6;i++)

{

s=0;

for(j=0;j<56;j++)

{

if(checktabl[j][i]==0)

{

s+=test[j];

};

};

tmpmas[i]=s%2;

};

for(j=0;j<3;j++)

{

if(tmpmas[j*2]!=test[58+j*4]) check[j*2]=0;

if(tmpmas[j*2+1]!=test[59+j*4]) check[j*2+1]=0;

};

short n=0;

for(i=0;i<6;i++)

{

if(check[i]==0)

{

n++;

};

};

if(n>1) n=0;

else n=1;

switch (n)

{

case 0://якщо контрольна сума не спiвпадае

{

for(i=0;i<56;i++)

{

short eq=1;

for(j=0;j<6;j++)

{

if(check[j]!=checktabl[i][j])

{

eq=0;

break;

};

};

if(eq==1)

{

if(test[i]==1) test[i]=0;

else test[i]=1;

break;

};

};

};

case 1: //якщо контрольна сума спiвпадае

{

for(i=0;i<8;i++)

{

for(j=0;j<7;j++)

{

testtab[j]=test[i*7+j];

};

short eq2;

for(j=0;j<10;j++)

{

short eq=1;

eq2=0;

for(s=0;s<7;s++)

{

if(testtab[s]!=tabl[j][s])

{

eq=0;

break;

};

};

if(eq==1)

{

testcod[i]=j;

eq2=1;

break;

}

};

if(eq2==0)

{

ferr++;

return;

}

};

short t;

t=(testcod[0]+testcod[2]+testcod[4]+testcod[6]+3*(testcod[1]+testcod[3]+testcod[5]))%10;

if(t!=testcod[7])

{

ferr++;

return;

};

for(i=0;i<8;i++)

{

if(testcod[i]!=cod[i])

{

for(j=0;j<8;j++) ecode[j]=testcod[j]+48;

warning++;

info();

return;

};

};

nferr++;

return;

};

};

}

Додаток 2

Компьютерні системи та мережі

Опис програми

Університет “Україна” ЗКС52.35-14Б-13-2

Аркушів 6

2014

В ході виконання цієї дипломної роботи було створено пакет з чотирьох програм: Moonbug, Koran, Oldkoran та Hem8. В цьому розділі буде приведено їх опис та інструкції користувача.

Koran та Oldkoran по суті це одна й та сама програма, тому в цій роботі приведено лістинг тільки першої. Різниця між цими програмами тільки в таблиці кодування чисел коду. Koran використовує для кодування таблицю бітових рядів матриця кодових відстаней яких не містить одиниць, про необхідність цього наголошувалось в попередньому розділі. Цю необхідність добре було видно при порівнянні результатів роботи цих двох програм. Оldkoran використовує для кодування таблицю бітових рядів, матриця кодових відстаней яких містить одиниці, що збільшує ймовірність появи таких помилок, які не тільки не будуть виправлені, а й не будуть виявлені.

Koran та Oldkoran це DOS-програми, створені за допомогою компілятора Borland C++ 3.1. Запустивши їх побачимо слідуюче меню.

Der Diplomprojekt v.1.2 'Koran' Mishel Kozak

1. Beginn prufung

2. Fortsetzen prufung

?

Перший пункт - розпочати тест, другий - продовжити. В разі якщо ми починаємо тест, вибираємо перший пункт натиснувши "1", після якого програма поцікавиться іменем файлу в який буде записуватися інформація стосовно нашого тесту:

Der Diplomprojekt v.1.2 'Koran' Mishel Kozak

Einfurst der Filename(*.krn): [ ]

Після вводу імені файла, програмі необхідно вказати з якого коду починати тестування:

Der Diplomprojekt v.1.2 'Koran' Mishel Kozak

Einfurst anfangs kode: [ ]

Програма перевірятиме вся коди починаючи з введеного. Для повного тесту необхідно вказати код 0000000. Можливість введення початкового коду передбачена на випадок якщо тестування буде проводитися на кількох ЕОМ. Ввівши початковий код програма виводить новий запит:

Der Diplomprojekt v.1.2 'Koran' Mishel Kozak

Einfurst anfangs kode: [1111111]

Einfurst der Anzahl fehler(1/2): [ ]

Їй необхідно вказати кількість помилок яку вона повинна генерувати. Після вводу кількості помилок програма розпочинає тестування. В файлі котрий ми вказали буде записано всю інформацію яка буде необхідна для продовження раніше розпочатого, але перерваного тесту. В файлі зберігається останній перевірений код, кількість помилок яка генерується в коді, та вся статистика досліду.

Якщо тест нами було розпочато раніше і зараз нам потрібно його продовжити, то в початковому меню вибираємо другий пункт натиснувши "2". Програма поцікавиться іменем файлу в якому зберігається наш тест.

Der Diplomprojekt v.1.2 'Koran' Mishel Kozak

Einfurst der Filename(*.krn): [ ]

На відміну від випадку в першому пункті, тут очікується що такий файл уже існує, інакше програма не розпочне тестування. Решту інфомації програма отримає з цього файла й розпочне тестування.

Під час тестування на дисплеї ЕОМ періодично виводиться проміжкова інформація про процес тестування.

Der Diplomprojekt v.1.2 'Koran' Mishel Kozak

May 26 15:38:00 1999

Code: 0 0 0 0 2 6 8 8

Code: № + +

Type error: 2

_ 1_ 1_ 1_ 1_ 1_ 1_ 1_ 1_1 _1 _1 _1_

Real___ __ ___ __ ___ __ ___ __ __ _ _ _ _ _ __ _ __ _ _ _ __ _ _

error___ __ ___ __ ___ __ ___ __ __ _ _ _ _ _ __ _ __ _ _ _ __ _ _

Total error: 668465

= fatal error: 274380 41.046278%

= corectly error: 394085 58.953722%

= warning error: 0 0%

For exit press 'q'...

Ми можемо бачити який саме зараз код тестується, скільки помилкових кодів було згенеровано, скільки з них виявлено, виправлено, чи не виявлено, останні три показника демонструються в кількісному виді та в відсотковому відношенні один до одного.

Програма перебирає всі коди починаючи з початкового, який ми вказали на початку тесту. Для кожного коду програма генерую всі можливі помилки. Оскільки наш код складається з 71 біта, то в разі генерації однієї помилки буде згенеровано 71 помилковий код, а в випадку генерації двох помилок 1+2+3+...+69+70=70*71/2=2485. Згенерувавши помилковий код програма намагається виявити та виправити в ньому помилку. При цьому можливі три випадки:

- помилку виявлено та виправлено;

- помилку виявлено;

- помилку не виявлено.

перші два випадки є допустимими, а третій ні, бо він означає, що код було зчитано неправильно, але ЕОМ про це непідозрює. Така помилка не можлива при наявності одного помилкового біту в коді. Як буде видно з результатів програм Oldkoran допускає всі три випадки, в той час як Koran при двох помилках в коді третьго випадку не допускає. Глянувши на матрицю кодових відстаней бачимо, що й при генерації трьох помилок в коді така ситуація неможлива.

Moonbug. Ця програма створена за допомогою Borland C++ Builder4.0 для Win32. По своїй суті ця програма є аналогом програми Koran. Вона була створена як демонстраційна програма. Основною відмінністю її від Koran є дружній інтерфейс користувача, створений на основі Win32.

Але в наслідок цього в програми різко знижена швидкодія, через що використання її для повноцінного тестування всього набору кодів не рекомендована.

Для початку роботи, після запуску програми необхідно натиснути кнопку “Start”. Після цього ввести стартовий код, та кількість помилок яка повинна генеруватися (див. малюнок). Після внесення стартової інформації, натиснувши кнопку “Test”, розпочинаємо тестування.

Через певний проміжок часу (значення таймера демонструється в відповідному полі) статистика нашого тесту обновляється, виводячи на екран інформацію про кількість згенерованих помилок та кількість не виявлених, виправлених і тільки виявлених помилок. Ця сама інформація відображається в виді кругової діаграми(див малюнок).

Частоту обновлення інформації можна змінювіти за допомогою відповідного повзунка на головному вікні. Ця можливість передбачина для покращення швидкодії програми, оскільки вивід на екран інформації забирає деяку кількість часу.

Обновити статистику тесту можна й не дочікуючися завершення відліку таймера, а просто вибравши в меню пункт “статистика”. Роботу програми можна тимчасово призупинити натиснувши для цього кнопку “Stop” на головному вікні, або вибравши в меню аналогічний пункт. Крім того в меню є ще два пункти – “початок”, він є аналогом кнопки “Start”, та пункт “Програма”. Вибравши цей пункт можна отримати інформацію про програму:

Hem8. Ця програма створена для генерування штрихового коду типу НЕМ-8. Вона створена за допомогою Borland C++ Builder4.0 як програма для Win32. Зовнішній вид програми зображено на малюнку.

При використанні програми користувач повинен ввести 7-ми значний код. Після цього натиснути кнопку генерації коду. Програма обчислює контрольне восьме число коду й відображає зовнішній вид штрихового коду, що відповідає введеному числовому значенню.