Рекурсивный алгоритм распознавания образов, страница 4

for(i=1;i<=StrToInt(ENPer->Text);i++)

{

str="L1("+IntToStr(i)+"): ";

for(j=1;j<=StrToInt(ENPer->Text);j++)

{

str=str+' '+FloatToStrF(L1[i][j],ffFixed,6,6);

if((str.Length()>55)&&(j<StrToInt(ENPer->Text)))

{

LBG->Items->Add(str);

str="    ";

}

}

LBG->Items->Add(str);

}

str="";

LBG->Items->Add(str);

for(i=1;i<=StrToInt(ENClas->Text);i++)

{

str="g("+IntToStr(i)+"): ";

for(j=0;j<=StrToInt(ENPer->Text);j++)

{

str=str+' '+FloatToStrF(g[i][j],ffFixed,6,6);

if((str.Length()>55)&&(j<StrToInt(ENPer->Text)))

{

LBG->Items->Add(str);

str="    ";

}

}

LBG->Items->Add(str);

}

for(i=1;i<=StrToInt(ENNab->Text);i++)

{

sum=Prognoz(&Data[(i-1)*(StrToInt(ENPer->Text)+1)],StrToInt(ENClas-> Text),StrToInt(ENPer->Text));

if(sum!=Data[i*(StrToInt(ENPer->Text)+1)])

{

k=StrToInt(Label2->Caption);

k++;

Label2->Caption=IntToStr(k);

}

}

delete[] P;

for (i=0;i<StrToInt(ENClas->Text)+1; i++)

{

delete[] M[i];

}

for (i=0;i<StrToInt(ENPer->Text)+1; i++)

{

delete[] L[i];

}

for (i=0;i<StrToInt(ENPer->Text)+1; i++)

{

delete[] L1[i];

}

delete[] vec;

////////////////////////////////////

}

else

ShowMessage(AnsiString("Не верны исходные данные!!!"));

}

//--------------------------------------------------------------------------void __fastcall TForm1::FormCreate(TObject *Sender)

{

GBRasp->Height = 0;

LBData->Height = 0;

LBData->Top = 0;

LBData->Width = 0;

LBG->Height = 0;

LBG->Top = 0;

LBG->Width = 0;

GBAnaliz->Width = 0;

GBOperat->Width = 198;

GBNewNab->Width = 0;

GBNewNab->Top = 0;

Form1->ClientHeight = 134;

Form1->ClientWidth = 372;

LChange->Width = 0;

Data = new float [dim];

}

//--------------------------------------------------------------------------void __fastcall TForm1::Button10Click(TObject *Sender)

{

delete[] Data;

for (int i=0;i<StrToInt(ENClas->Text)+1; i++)

{

delete[] g[i];

}

Form1->Close();

}

//--------------------------------------------------------------------------void __fastcall TForm1::Button8Click(TObject *Sender)

{

GBRasp->Height = 0;

Label2->Caption='0';

LBG->Clear();

ENPer->Enabled = true;

ENClas->Enabled = true;

GBAnaliz->Width = 0;

GBOperat->Width = 198;

Form1->ClientWidth = 359;

Form1->ClientHeight = 134;

LBG->Height = 0;

LBG->Top = 0;

LBG->Width = 0;

for (int i=0;i<StrToInt(ENClas->Text)+1; i++)

{

delete[] g[i];

}

}

//--------------------------------------------------------------------------void __fastcall TForm1::ENPerChange(TObject *Sender)

{

LChange->Width = 165;

}

//--------------------------------------------------------------------------void __fastcall TForm1::ENClasChange(TObject *Sender)

{

LChange->Width = 165;

}

//--------------------------------------------------------------------------void __fastcall TForm1::ENNabChange(TObject *Sender)

{

LChange->Width = 165;

if((ENNab->Text.Length()>0)&&(ENNab->Text[1]!='0'))

{

ENPer->Enabled = false;

ENClas->Enabled = false;

}

}

//--------------------------------------------------------------------------void __fastcall TForm1::Button2Click(TObject *Sender)

{

if((StrToInt(ENPer->Text)>0)&&(StrToInt(ENClas->Text)>0)&&(StrToInt(ENNab->Text)>0))

{

if(SaveDialog1->Execute())

{

LChange->Width = 0;

EFileName->Text = SaveDialog1->FileName;

int f1=FileCreate(EFileName->Text);

AnsiString chr="";

chr = ENPer->Text;

chr = chr + '\n';

FileWrite(f1,&chr[1],chr.Length());

chr = ENClas->Text;

chr = chr + '\n';

FileWrite(f1,&chr[1],chr.Length());

chr = ENNab->Text;

chr = chr + '\n';

FileWrite(f1,&chr[1],chr.Length());

int i,j,sum;

for(i=1;i<=StrToInt(ENNab->Text);i++)

{

chr="";

for(j=1;j<=StrToInt(ENPer->Text);j++)

{

chr=chr+FloatToStrF(Data[(i-1)*(StrToInt(ENPer->Text)+1)+j], ffFixed,6,6)+" ";

}

chr=chr+FloatToStrF(Data[i*(StrToInt(ENPer->Text)+1)],ffFixed,6,0)+" ";