www.pudn.com > Apriori(Finish).rar > Unit1.cpp


//--------------------------------------------------------------------------- 
 
#include  
#pragma hdrstop 
 
#include "Unit1.h" 
#include  
#include "Unit2.h" 
vector a; 
vector >  b; 
vector c; 
//--------------------------------------------------------------------------- 
#pragma package(smart_init) 
#pragma link "CGAUGES" 
#pragma resource "*.dfm" 
TForm1 *Form1; 
//--------------------------------------------------------------------------- 
__fastcall TForm1::TForm1(TComponent* Owner) 
        : TForm(Owner) 
{ 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::Button1Click(TObject *Sender) 
{ 
 if(OpenDialog1->Execute()) 
    { 
        int wc=0; 
      //  for(int c=0;cColCount;c++) 
        //    for(int r=1;rRowCount;r++) 
          //      StringGrid1->Cells[c][r]="";     //清空StringGrid1 
        TStringList *list=new TStringList(); 
        TStringList *sub=new TStringList(); 
        list->LoadFromFile(OpenDialog1->FileName); 
        StringGrid1->RowCount=list->Count; 
        //StringGrid1->Cells[0][0]="Tid"; 
        //StringGrid1->Cells[1][0]="Item"; 
        for(int r=0;rCount;r++) 
        { 
            sub->Delimiter=',';//逗號作為分隔符號 
            sub->DelimitedText=list->Strings[r]; 
            for(int c=0;cCount;c++) 
                StringGrid1->Cells[0+c][r]=sub->Strings[c]; 
        } 
        delete list; 
        delete sub; 
} 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::Button2Click(TObject *Sender) 
{ 
ListBox1->Clear(); 
ListBox2->Clear(); 
ListBox3->Clear(); 
ListBox4->Clear(); 
ListBox5->Clear(); 
ListBox6->Clear(); 
ListBox7->Clear(); 
ListBox8->Clear(); 
ListBox9->Clear(); 
ListBox10->Clear(); 
CheckBox1->Checked=false; 
CheckBox2->Checked=false; 
CheckBox3->Checked=false; 
CheckBox4->Checked=false; 
CheckBox5->Checked=false; 
a.clear(); 
c.clear(); 
CGauge1->Progress =0; 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::Button3Click(TObject *Sender) 
{ 
ListBox1->Clear(); 
ListBox2->Clear(); 
ListBox3->Clear(); 
ListBox4->Clear(); 
ListBox5->Clear(); 
ListBox6->Clear(); 
ListBox7->Clear(); 
ListBox8->Clear(); 
ListBox9->Clear(); 
ListBox10->Clear(); 
a.clear(); 
c.clear(); 
CGauge1->Progress =0; 
 
 
        AnsiString aaditem; 
        AnsiString baditem; 
        AnsiString caditem; 
        int minsu; //最小支持度暫存值 
        minsu=StrToInt(minsup->Text); 
 
//vector temp; 
//b.push_back( temp); 
 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //開始從txt抓資料到stringgrid1 - 開始 
                int kk =0; //計算出現個數(支持度) 
                int k = 0; //計算該項目第幾次出現 
                aaditem=StringGrid1->Cells[1][i]; //stringgrid1之暫存區,藉以比對求k,看第幾次出現 
                for(int j = 1;j<=StringGrid1->RowCount-1;j++) 
                { //計算支持度 - 開始 
                        if(aaditem == StringGrid1->Cells[1][j]) 
                        { //計算出現個數(支持度) - 開始 
                                kk++; 
                        } //計算出現個數(支持度) - 結束 
                } //計算支持度 -結束 
                if(kk>=minsu) 
                { //計算符合大於設定支持度的項目 - 開始 
                        for(int ii =0; iiClear(); 
        ListBox2->Clear(); 
        c.clear() ; 
        aaditem =""; 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //將第二階段資料丟入陣列-開始 
                int oo=0; 
                aaditem=StringGrid1->Cells[0][i]; 
                for(int j = i+1;j<=StringGrid1->RowCount;j++) 
                { //將每筆資料放入暫存區 -開始 
                        baditem=StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]; //暫存,欲比對之資料 
                        if(aaditem == StringGrid1->Cells[0][j]) 
                        { //將每筆資料丟入陣列(與暫存區比較)-開始 
                                c.push_back(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]); 
                        } //將每筆資料丟入陣列與暫存區比較)-結束 
                 } //將每筆資料放入暫存區 -結束 
        } //將第二階段資料丟入陣列-結束 
        aaditem=""; 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //第二階段正式開始 -開始 
                aaditem=StringGrid1->Cells[0][i]; 
                for(int j = i+1;j<=StringGrid1->RowCount;j++) 
                { //計算支持度 - 開始 
                        baditem=StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]; 
                        int oo=0; 
                        for(int uu=0;uu<=StringGrid1->RowCount; uu++) 
                        { 
 
 
                                        oo++; 
                              
                        } 
                        if(aaditem == StringGrid1->Cells[0][j]) 
                        { //計算出現個數(支持度) - 開始 
                                int o=0; 
                                for(int pp=0; pp<=a.size() ;pp++) 
                                { 
                                } 
                                if(o==0) 
                                { //我們只要標示第0次出現的即可(第0次表示第一個) 
                                        if(oo>=minsu) 
                                        { //找出符合要求的最小支持度 -開始 
                                                 a.push_back(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]); 
                                        } //找出符合要求的最小支持度 -結束 
                                } //我們只要標示第0次出現的即可(第0次表示第一個) 
                        } //計算出現個數(支持度) - 結束 
                } //計算支持度 -結束 
        } //第二階段正式開始 -結束 
        a.clear() ; 
        aaditem =""; 
//Section 1 ..................................................................................... 
if(CheckBox1->Checked==true) 
{ 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //開始從txt抓資料到stringgrid1 - 開始 
                int kk =0; //計算出現個數(支持度) 
                int k = 0; //計算該項目第幾次出現 
                aaditem=StringGrid1->Cells[1][i]; //stringgrid1之暫存區,藉以比對求k,看第幾次出現 
                for(int j = 1;j<=StringGrid1->RowCount-1;j++) 
                { //計算支持度 - 開始 
                        if(aaditem == StringGrid1->Cells[1][j]) 
                        { //計算出現個數(支持度) - 開始 
                                kk++; 
                        } //計算出現個數(支持度) - 結束 
                } //計算支持度 -結束 
                if(kk>=minsu) 
                { //計算符合大於設定支持度的項目 - 開始 
                        for(int ii =0; iiItems->Add(StringGrid1->Cells[1][i]); //list1列出所有項目 
                                ListBox2->Items->Add(kk); //list2列出各個的支持度 
                        } //列出符合最小支持度的項目 - 結束 
                } //計算符合大於設定支持度的項目 - 結束 
        }//開始從txt抓資料到stringgrid1 - 結束 
} 
//Section 2 ..................................................................................... 
int oo=0; 
int o =0; 
 
if(CheckBox2->Checked==true) 
{ 
        a.clear(); 
 
        aaditem =""; 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //將第二階段資料丟入陣列-開始 
                oo=0; 
                aaditem=StringGrid1->Cells[0][i]; 
                for(int j = i+1;j<=StringGrid1->RowCount;j++) 
                { //將每筆資料放入暫存區 -開始 
                        baditem=StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]; //暫存,欲比對之資料 
                        if(aaditem == StringGrid1->Cells[0][j]) 
                        { //將每筆資料丟入陣列(與暫存區比較)-開始 
                                c.push_back(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]); 
                        } //將每筆資料丟入陣列與暫存區比較)-結束 
                 } //將每筆資料放入暫存區 -結束 
        } //將第二階段資料丟入陣列-結束 
        aaditem=""; 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //第二階段正式開始 -開始 
 
                aaditem=StringGrid1->Cells[0][i]; 
                for(int j = i+1;j<=StringGrid1->RowCount;j++) 
                { //計算支持度 - 開始 
                 
                        baditem=StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]; 
                        oo=0; 
                        for(int uu=0;uu<=StringGrid1->RowCount; uu++) 
                        { 
                                if(baditem==c[uu]) 
                                { 
                                        oo++; 
                                } 
                        } 
                        if(aaditem == StringGrid1->Cells[0][j]) 
                        { //計算出現個數(支持度) - 開始 
                                o=0; 
                                for(int pp=0; pp<=a.size() ;pp++) 
                                { 
                                        if((StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j])==a[pp]) 
                                        { 
                                                o++; //為下段使用做準備 
                                        } 
                                } 
                                if(o==0) 
                                { //我們只要標示第0次出現的即可(第0次表示第一個) 
                                        if(oo>=minsu) 
                                        { //找出符合要求的最小支持度 -開始 
                                                 ListBox3->Items->Add(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]); 
                                                 a.push_back(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]); 
                                                 ListBox4->Items->Add(oo); 
                                        } //找出符合要求的最小支持度 -結束 
                                } //我們只要標示第0次出現的即可(第0次表示第一個) 
                        } //計算出現個數(支持度) - 結束 
                } //計算支持度 -結束 
        } //第二階段正式開始 -結束 
} 
//Section 3 ..................................................................................... 
if(CheckBox3->Checked==true) 
{ 
        a.clear(); 
        c.clear(); 
        aaditem =""; 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //將第三階段資料丟入陣列-開始 
                oo=0; 
                for(int j = i+1;j<=StringGrid1->RowCount;j++) 
                { //將每筆資料放入暫存區 -開始 
                        for(int k=j+1;k<=StringGrid1->RowCount ;k++) 
                        {//k 
                        aaditem=StringGrid1->Cells[0][i]; 
                        baditem=StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]; //暫存,欲比對之資料 
                        if(aaditem == StringGrid1->Cells[0][k]) 
                        { //將每筆資料丟入陣列(與暫存區比較)-開始 
                                c.push_back(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]); 
                                //ListBox5->Items->Add(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]); 
                        } //將每筆資料丟入陣列與暫存區比較)-結束 
                        }//k 
                 } //將每筆資料放入暫存區 -結束 
        } //將第三階段資料丟入陣列-結束 
        aaditem=""; 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //第三階段正式開始 -開始 
        aaditem=StringGrid1->Cells[0][i]; 
                for(int j = i+1;j<=StringGrid1->RowCount;j++) 
                { //計算支持度 - 開始 
 
                        for(int k=j+1;k<=StringGrid1->RowCount ;k++) 
                        {//k 
 
                        baditem=StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]; 
                        oo=0; 
                        for(int uu=0;uu<=StringGrid1->RowCount; uu++) 
                        { 
                                if(baditem==c[uu]) 
                                { 
                                        oo++; 
                                } 
                        } 
                        if(aaditem == StringGrid1->Cells[0][k]) 
                        { //計算出現個數(支持度) - 開始 
                                o=0; 
                                for(int pp=0; pp<=a.size() ;pp++) 
                                { 
                                        if((StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k])==a[pp]) 
                                        { 
                                                o++; //為下段使用做準備 
                                        } 
                                } 
                                if(o==0) 
                                { //我們只要標示第0次出現的即可(第0次表示第一個) 
                                        if(oo>=minsu) 
                                        { //找出符合要求的最小支持度 -開始 
                                                 ListBox5->Items->Add(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]); 
                                                 a.push_back(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]); 
                                                 ListBox6->Items->Add(oo); 
                                        } //找出符合要求的最小支持度 -結束 
                                } //我們只要標示第0次出現的即可(第0次表示第一個) 
                        } //計算出現個數(支持度) - 結束 
                        }//K 
                } //計算支持度 -結束 
        } //第三階段正式開始 -結束 
} 
//Section 4 ..................................................................................... 
if(CheckBox4->Checked==true) 
{ 
        a.clear(); 
        c.clear(); 
        aaditem =""; 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //將第四階段資料丟入陣列-開始 
                oo=0; 
                for(int j = i+1;j<=StringGrid1->RowCount;j++) 
                { //將每筆資料放入暫存區 -開始 
                        for(int k=j+1;k<=StringGrid1->RowCount ;k++) 
                        {//k 
                                for(int l=k+1;l<=StringGrid1->RowCount; l++) 
                                {//l 
                                        aaditem=StringGrid1->Cells[0][i]; 
                                        if(aaditem == StringGrid1->Cells[0][l]) 
                                        { //將每筆資料丟入陣列(與暫存區比較)-開始 
                                                c.push_back(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]); 
                                                //ListBox7->Items->Add(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]); 
                                        } //將每筆資料丟入陣列與暫存區比較)-結束 
                                }//l 
                        }//k 
                 } //將每筆資料放入暫存區 -結束 
        } //將第四階段資料丟入陣列-結束 
        aaditem=""; 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //第四階段正式開始 -開始 
        aaditem=StringGrid1->Cells[0][i]; 
                for(int j = i+1;j<=StringGrid1->RowCount;j++) 
                { //計算支持度 - 開始 
                        for(int k=j+1;k<=StringGrid1->RowCount ;k++) 
                        {//k 
                                for(int l=k+1;l<=StringGrid1->RowCount; l++) 
                                {//l 
                                baditem=StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]; 
                                oo=0; 
                                for(int uu=0;uu<=StringGrid1->RowCount; uu++) 
                                { 
                                        if(baditem==c[uu]) 
                                        { 
                                                oo++; 
                                        } 
                                } 
                                if(aaditem == StringGrid1->Cells[0][l]) 
                                { //計算出現個數(支持度) - 開始 
                                        o=0; 
                                        for(int pp=0; pp<=a.size() ;pp++) 
                                        { 
                                                if((StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l])==a[pp]) 
                                                { 
                                                        o++; //為下段使用做準備 
                                                } 
                                        } 
                                        if(o==0) 
                                        { //我們只要標示第0次出現的即可(第0次表示第一個) 
                                                if(oo>=minsu) 
                                                { //找出符合要求的最小支持度 -開始 
                                                        ListBox7->Items->Add(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]); 
                                                        a.push_back(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]); 
                                                        ListBox8->Items->Add(oo); 
                                                } //找出符合要求的最小支持度 -結束 
                                        } //我們只要標示第0次出現的即可(第0次表示第一個) 
                                } //計算出現個數(支持度) - 結束 
                                }//l 
                        }//K 
                } //計算支持度 -結束 
        } //第四階段正式開始 -結束 
} 
//section 5........................................ 
if(CheckBox5->Checked==true) 
{ 
        a.clear(); 
        c.clear(); 
        aaditem =""; 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //將第5階段資料丟入陣列-開始 
                oo=0; 
                for(int j = i+1;j<=StringGrid1->RowCount;j++) 
                { //將每筆資料放入暫存區 -開始 
                        for(int k=j+1;k<=StringGrid1->RowCount ;k++) 
                        {//k 
                                for(int l=k+1;l<=StringGrid1->RowCount; l++) 
                                {//l 
                                        for(int m=l+1; m<=StringGrid1->RowCount; m++) 
                                        {//m 
                                                aaditem=StringGrid1->Cells[0][i]; 
                                                if(aaditem == StringGrid1->Cells[0][m]) 
                                                { //將每筆資料丟入陣列(與暫存區比較)-開始 
                                                        c.push_back(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]+" , "+StringGrid1->Cells[1][m]); 
                                                        //ListBox9->Items->Add(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]+" , "+StringGrid1->Cells[1][m]); 
                                                } //將每筆資料丟入陣列與暫存區比較)-結束 
                                        }//m 
                                }//l 
                        }//k 
                 } //將每筆資料放入暫存區 -結束 
        } //將第5階段資料丟入陣列-結束 
        aaditem=""; 
        for(int i=1;i<=StringGrid1->RowCount-1;i++) 
        { //第5階段正式開始 -開始 
        aaditem=StringGrid1->Cells[0][i]; 
                for(int j = i+1;j<=StringGrid1->RowCount;j++) 
                { //計算支持度 - 開始 
                        for(int k=j+1;k<=StringGrid1->RowCount ;k++) 
                        {//k 
                                for(int l=k+1;l<=StringGrid1->RowCount; l++) 
                                {//l 
                                for(int m=l+1; m<=StringGrid1->RowCount; m++) 
                                {//m 
                                baditem=StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]+" , "+StringGrid1->Cells[1][m]; 
                                oo=0; 
                                for(int uu=0;uu<=StringGrid1->RowCount; uu++) 
                                { 
                                        if(baditem==c[uu]) 
                                        { 
                                                oo++; 
                                        } 
                                } 
                                if(aaditem == StringGrid1->Cells[0][l]) 
                                { //計算出現個數(支持度) - 開始 
                                        o=0; 
                                        for(int pp=0; pp<=a.size() ;pp++) 
                                        { 
                                                if((StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]+" , "+StringGrid1->Cells[1][m])==a[pp]) 
                                                { 
                                                        o++; //為下段使用做準備 
                                                } 
                                        } 
                                        if(o==0) 
                                        { //我們只要標示第0次出現的即可(第0次表示第一個) 
                                                if(oo>=minsu) 
                                                { //找出符合要求的最小支持度 -開始 
                                                        ListBox9->Items->Add(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]+" , "+StringGrid1->Cells[1][m]); 
                                                        a.push_back(StringGrid1->Cells[1][i]+" , "+StringGrid1->Cells[1][j]+" , "+StringGrid1->Cells[1][k]+" , "+StringGrid1->Cells[1][l]+" , "+StringGrid1->Cells[1][m]); 
                                                        ListBox10->Items->Add(oo); 
                                                } //找出符合要求的最小支持度 -結束 
                                        } //我們只要標示第0次出現的即可(第0次表示第一個) 
                                } //計算出現個數(支持度) - 結束 
                                }//M 
                                }//l 
                        }//K 
                } //計算支持度 -結束 
        } //第5階段正式開始 -結束 
} 
for(int jj=0; jj<=100;jj++) 
{ 
CGauge1->MaxValue = 100; 
CGauge1->MinValue = 0; 
CGauge1->Progress = jj+1; 
} 
 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::ListBox1Click(TObject *Sender) 
{ 
String drug; 
String drugg; 
int i; 
i = ListBox1->ItemIndex; 
drug = ListBox1->Items->Strings[i] ; 
drugg= ListBox2->Items->Strings[i] ; 
Form1->Caption = drug + " 的支持度為: " +drugg; 
//Form1->Caption = drug + " ListBox1->ItemIndex = " + IntToStr(i) ; 
} 
//--------------------------------------------------------------------------- 
 
void __fastcall TForm1::ListBox3Click(TObject *Sender) 
{ 
String drug; 
String drugg; 
int i; 
i = ListBox3->ItemIndex; 
drug = ListBox3->Items->Strings[i] ; 
drugg= ListBox4->Items->Strings[i] ; 
Form1->Caption = drug + " 的支持度為: " +drugg; 
} 
//--------------------------------------------------------------------------- 
 
void __fastcall TForm1::ListBox5Click(TObject *Sender) 
{ 
String drug; 
String drugg; 
int i; 
i = ListBox5->ItemIndex; 
drug = ListBox5->Items->Strings[i] ; 
drugg= ListBox6->Items->Strings[i] ; 
Form1->Caption = drug + " 的支持度為: " +drugg; 
} 
//--------------------------------------------------------------------------- 
 
void __fastcall TForm1::ListBox2Click(TObject *Sender) 
{ 
String drug; 
String drugg; 
int i; 
i = ListBox2->ItemIndex; 
drug = ListBox2->Items->Strings[i] ; 
drugg= ListBox1->Items->Strings[i] ; 
Form1->Caption = drugg + " 的支持度為: " +drug; 
//Form1->Caption = drug + " ListBox1->ItemIndex = " + IntToStr(i) ; 
} 
//--------------------------------------------------------------------------- 
 
void __fastcall TForm1::ListBox4Click(TObject *Sender) 
{ 
String drug; 
String drugg; 
int i; 
i = ListBox4->ItemIndex; 
drug = ListBox4->Items->Strings[i] ; 
drugg= ListBox3->Items->Strings[i] ; 
Form1->Caption = drugg + " 的支持度為: " +drug; 
//Form1->Caption = drug + " ListBox1->ItemIndex = " + IntToStr(i) ; 
} 
//--------------------------------------------------------------------------- 
 
void __fastcall TForm1::ListBox6Click(TObject *Sender) 
{ 
String drug; 
String drugg; 
int i; 
i = ListBox6->ItemIndex; 
drug = ListBox6->Items->Strings[i] ; 
drugg= ListBox5->Items->Strings[i] ; 
Form1->Caption = drugg + " 的支持度為: " +drug; 
//Form1->Caption = drug + " ListBox1->ItemIndex = " + IntToStr(i) ; 
} 
//--------------------------------------------------------------------------- 
 
void __fastcall TForm1::ListBox7Click(TObject *Sender) 
{ 
String drug; 
String drugg; 
int i; 
i = ListBox7->ItemIndex; 
drug = ListBox7->Items->Strings[i] ; 
drugg= ListBox8->Items->Strings[i] ; 
Form1->Caption = drug + " 的支持度為: " +drugg; 
} 
//--------------------------------------------------------------------------- 
 
void __fastcall TForm1::ListBox8Click(TObject *Sender) 
{ 
String drug; 
String drugg; 
int i; 
i = ListBox8->ItemIndex; 
drug = ListBox8->Items->Strings[i] ; 
drugg= ListBox7->Items->Strings[i] ; 
Form1->Caption = drugg + " 的支持度為: " +drug; 
//Form1->Caption = drug + " ListBox1->ItemIndex = " + IntToStr(i) ; 
} 
//--------------------------------------------------------------------------- 
 
void __fastcall TForm1::ListBox9Click(TObject *Sender) 
{ 
String drug; 
String drugg; 
int i; 
i = ListBox9->ItemIndex; 
drug = ListBox9->Items->Strings[i] ; 
drugg= ListBox10->Items->Strings[i] ; 
Form1->Caption = drug + " 的支持度為: " +drugg; 
} 
//--------------------------------------------------------------------------- 
 
void __fastcall TForm1::ListBox10Click(TObject *Sender) 
{ 
String drug; 
String drugg; 
int i; 
i = ListBox10->ItemIndex; 
drug = ListBox10->Items->Strings[i] ; 
drugg= ListBox9->Items->Strings[i] ; 
Form1->Caption = drugg + " 的支持度為: " +drug; 
} 
//--------------------------------------------------------------------------- 
 
 
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action) 
{ 
ListBox1->Clear(); 
ListBox2->Clear(); 
ListBox3->Clear(); 
ListBox4->Clear(); 
ListBox5->Clear(); 
ListBox6->Clear(); 
ListBox7->Clear(); 
ListBox8->Clear(); 
ListBox9->Clear(); 
ListBox10->Clear(); 
CheckBox1->Checked=false; 
CheckBox2->Checked=false; 
CheckBox3->Checked=false; 
CheckBox4->Checked=false; 
CheckBox5->Checked=false; 
a.clear(); 
c.clear(); 
CGauge1->Progress =0;         
} 
//---------------------------------------------------------------------------