I trying to write a program with Borland C++, but can't compile., what hell happen ?
Code:
1.for apr.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "apr.h"
#include <dos.h>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int goon;
long sa1,sa2,sa3,sa4;
long ea1,ea2,ea3,ea4;
long count;
unsigned int mm1,ss1,mm2,ss2,ts1,ts2,interval;
struct time t;
gettime(&t);
mm1=t.ti_min;
ss1=t.ti_sec;
Label2->Caption=IntToStr(mm1);
Label3->Caption=IntToStr(ss1);
Query1->SQL->Add("delete from AL1");
Query1->ExecSQL();
Query2->SQL->Add("select distinct Item from head where Item in ");
Query2->SQL->Add("(select Item from head ");
//mins
Query2->SQL->Add("group by Item having count(*)>=50)"); //min
Query2->Open();
while (Query2->Eof==0)
{
sa1=Query2->FieldByName("Item")->Value;
Query3->SQL->Clear();
Query3->SQL->Add("insert into AL1 (Item1) values (:x)");
Query3->ParamByName('x')->Value=sa1;
Query3->ExecSQL();
Query2->Next();
}
//L2************************************************ **************************
goon=0;
Query1->SQL->Clear();
Query2->SQL->Clear();
Query1->SQL->Add("delete from AC2");
Query1->ExecSQL();
Query1->SQL->Clear();
Query1->SQL->Add("delete from AL2");
Query1->ExecSQL();
Query1->SQL->Clear();
Query1->SQL->Add("delete from scan");
Query1->ExecSQL();
Query2->SQL->Add("select p.Item1 as i1, q.Item1 as i2 from AL1 p,AL1 q");
Query2->SQL->Add("where p.Item1<q.Item1");
Query2->Open();
while (Query2->Eof==0)
{
sa1=Query2->FieldByName("i1")->Value;
sa2=Query2->FieldByName("i2")->Value;
Query3->SQL->Clear();
Query3->SQL->Add("insert into AC2 (Item21,Item22) values (:x,:y)");
Query3->ParamByName('x')->Value=sa1;
Query3->ParamByName('y')->Value=sa2;
Query3->ExecSQL();
Query2->Next();
}
Query2->SQL->Clear();
Query2->SQL->Add("select * from AC2");
Query2->Open();
while (Query2->Eof==0)
{
sa1=Query2->FieldByName("Item21")->Value;
sa2=Query2->FieldByName("Item22")->Value;
Query3->SQL->Clear();
Query3->SQL->Add("select Cid,Time0 from head");
Query3->SQL->Add("where Item= :f or Item=:e");
Query3->SQL->Add("group by Cid,Time0");
Query3->SQL->Add("having count(*)>=50"); //min
Query3->ParamByName('f')->Value=sa1;
Query3->ParamByName('e')->Value=sa2;
Query3->Open();
while (Query3->Eof==0)
{
ea1=Query3->FieldByName("Cid")->Value;
ea2=Query3->FieldByName("Time0")->Value;
Query4->SQL->Clear();
Query4->SQL->Add("insert into scan (Cid,Time0) values (:x,:y)");
Query4->ParamByName('x')->Value=ea1;
Query4->ParamByName('y')->Value=ea2;
Query4->ExecSQL();
Query3->Next();
}
Query4->SQL->Clear();
Query4->SQL->Add("select count(*) from scan");
Query4->Open();
count=Query4->FieldByName("count(*)")->Value;
if (count >=50) //min
{
goon++;
Query4->SQL->Clear();
Query4->SQL->Add("insert into AL2 (Item21,Item22) values (:x,:y)");
Query4->ParamByName('x')->Value=sa1;
Query4->ParamByName('y')->Value=sa2;
Query4->ExecSQL();
}
Query4->SQL->Clear();
Query4->SQL->Add("delete from scan");
Query4->ExecSQL();
Query2->Next();
}
//************************************************** ************************
while (goon > 0)
{
goon=0;
Query1->SQL->Clear();
Query2->SQL->Clear();
Query1->SQL->Add("delete from AC3");
Query1->ExecSQL();
Query1->SQL->Clear();
Query1->SQL->Add("delete from AL3");
Query1->ExecSQL();
Query1->SQL->Clear();
Query1->SQL->Add("delete from scan");
Query1->ExecSQL();
Query2->SQL->Add("select p.Item21 as i1, p.Item22 as i2,");
Query2->SQL->Add("q.Item22 as i3 from AL2 p,AL2 q");
Query2->SQL->Add("where p.Item21=q.Item21 and p.Item22<q.Item22");
Query2->Open();
while (Query2->Eof==0)
{
sa1=Query2->FieldByName("i1")->Value;
sa2=Query2->FieldByName("i2")->Value;
sa3=Query2->FieldByName("i3")->Value;
Query3->SQL->Clear();
Query3->SQL->Add("insert into AC3 (Item31,Item32,Item33) values (:x,:y,:z)");
Query3->ParamByName('x')->Value=sa1;
Query3->ParamByName('y')->Value=sa2;
Query3->ParamByName('z')->Value=sa3;
Query3->ExecSQL();
Query2->Next();
}
2.for apr.h
//---------------------------------------------------------------------------
#ifndef aprH
#define aprH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Db.hpp>
#include <DBTables.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TQuery *Query1;
TQuery *Query2;
TQuery *Query3;
TQuery *Query4;
TLabel *Label1;
TLabel *Label2;
TLabel *Label3;
TLabel *Label4;
TLabel *Label5;
TButton *Button2;
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
3. for Apriori.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
USERES("Apriori.res");
USEFORM("apr.cpp", Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
//---------------------------------------------------------------------------[/COLOR]
thanks