Thread: Help ! Help!

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    2

    Question Help ! Help!

    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
    Last edited by Ken Fitlike; 11-19-2006 at 08:35 AM. Reason: just say 'no' to piink code

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Where? Where?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Can Can You You Pick Pick Better Better Topic Topic Titles?

    Perhaps your compiler hates as much as we do the sight of unindented pink code.
    What's the error messsage.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    unindented pink code
    Sounds like the title of a 70's horror movie. :]

  5. #5
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    How in the world did he make his code pink in the first place?
    Double Helix STL

  6. #6
    Registered User
    Join Date
    Nov 2006
    Posts
    25
    He put it like this:
    <CODE><COLOR="Lime">code here</COLOR></CODE>
    Code:
    RedOrangeYellowGreenBlueIndigoViolet

    Quote Originally Posted by simpleid
    Sounds like the title of a 70's horror movie. :]
    Hahaha
    Last edited by JDrake; 11-19-2006 at 08:12 AM.

  7. #7
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Thanks Ken
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  8. #8
    Registered User
    Join Date
    Nov 2006
    Posts
    2

    Cool

    Quote Originally Posted by JDrake
    He put it like this:
    <CODE><COLOR="Lime">code here</COLOR></CODE>
    Code:
    RedOrangeYellowGreenBlueIndigoViolet


    Hahaha
    did work!

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    And on that information-free response from the OP - closed.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed