a bit of C++ Builder...TParser? how use it?

  • 4 Replies
  • 3152 Views

0 Members and 1 Guest are viewing this topic.

*

Offline {XG}George

  • Member
  • Sr. Member
  • **
  • 47
  • +4/-0
    • View Profile
a bit of C++ Builder...TParser? how use it?
« on: 16 May 2014, 18:22:12 »
hi guys...
i haven't time to sleep cuz i need to make a program "Method of chords"....
dates i enter in Edit1
i need to use TParser but i don't know how to use it...
CAN SOMEBODY HELP ME?
TY
here is the code:

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

#include <vcl.h>
#pragma hdrstop

#include "metod_hord.h"
#include "Classes.hpp"

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "sSkinManager"
#pragma link "sBitBtn"
#pragma link "sButton"
#pragma resource "*.dfm"
TForm1 *Form1;
float a1,b1,c1;
TParser *pars = new TParser(); // :o
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
   : TForm(Owner)
{
}
//---------------------------------------------------------------------------
float __fastcall f(float x)
{
   if (Form1->ComboBox1->ItemIndex==0){
      return pow(x,3)-2*pow(x,2)-6*x-1;
   }
   if (Form1->ComboBox1->ItemIndex==1){
      return pow(x,3)-pow(x,2)+3;
   }
   if (Form1->ComboBox1->ItemIndex==2){
      return sin(x);
   }
   if (Form1->ComboBox1->ItemIndex==2){
      return cos(x);
   }


}
//---------------------------------------------------------------------------
float __fastcall hord(float m, float n, float e)
{
   while (fabs(n-m)>e)
   {
     m=n-(m-n)*f(n)/(f(n)-f(m));
     n=m-(m-n)*f(m)/(f(m)-f(n));
   }
   return n;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
float f,a,b,e;
if ((Edit2->Text=="")||(Edit3->Text=="")|| (Edit4->Text=="")|| (ComboBox1->ItemIndex==-1)){
   ShowMessage("enter corrrect dates");
}
a=StrToFloat(Edit2->Text);
b=StrToFloat(Edit3->Text);
e=StrToFloat(Edit4->Text);
Edit1->Text=FloatToStrF(hord(a,b,e),ffGeneral, 5, 2);
Edit1->Visible=true;
if ((hord(a,b,e)<=-0.3)||(hord(a,b,e)==0.3))  {
   Edit1->Text= "no result";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N6Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N4Click(TObject *Sender)
{
TStringList * List=new TStringList;
List->Add(Edit1->Text);
List->SaveToFile("1.txt");
delete List;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N5Click(TObject *Sender)
{
if( SaveDialog1->Execute() )
{
TStringList * List=new TStringList;
List->Add(Edit1->Text);
List->SaveToFile("1.txt");
delete List;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
Edit1->Clear();
Edit2->Clear();         // cleare all
Edit3->Clear();
Edit4->Clear();
ComboBox1->ItemIndex=-1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn2Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N11Click(TObject *Sender)
{
Form2->Show();  //open "About "
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N10Click(TObject *Sender)
{
ShellExecute(Handle, L"open", L"Help.chm", NULL, NULL, SW_SHOWNORMAL); //open "Help"

*

Offline {XG}George

  • Member
  • Sr. Member
  • **
  • 47
  • +4/-0
    • View Profile
Re: a bit of C++ Builder...TParser? how use it?
« Reply #1 on: 17 May 2014, 09:19:19 »
damn...nobody know?

*

Offline {XG}BillClinton

  • Clan Leader
  • Hero Member
  • *****
  • 697
  • +89/-7
  • I did not have sexual relations with that woman.
    • View Profile
Re: a bit of C++ Builder...TParser? how use it?
« Reply #2 on: 17 May 2014, 14:38:25 »
I really don't know man :c
                                                 

*

AnonAymous

  • Guest
Re: a bit of C++ Builder...TParser? how use it?
« Reply #3 on: 17 May 2014, 16:40:38 »
WTF...

*

Offline {XG}George

  • Member
  • Sr. Member
  • **
  • 47
  • +4/-0
    • View Profile
Re: a bit of C++ Builder...TParser? how use it?
« Reply #4 on: 17 May 2014, 18:18:19 »
Edit1 don't understand "pow(x,3)-2*pow(x,2)-6*x-1"
if I will use TParser he will.
But i don't know how to use TParser :'(