"Christmas - the time to fix the computers of your loved ones" « Lord Wyrm

Borland C++ Builder Referenz & Problem

moidaschl 27.02.2004 - 20:24 989 24
Posts

moidaschl

Vollzeit-Hackler
Avatar
Registered: Aug 2002
Location: 1210, ABK-D/L
Posts: 4029
haaaa rennt danke :)

edit:

des heist bei den strings add wirds auch + sein nehm ich an!

XeroXs

doh
Avatar
Registered: Nov 2000
Location: Lieboch
Posts: 10334
den letzten satz von dir kapier ich nicht :confused:

moidaschl

Vollzeit-Hackler
Avatar
Registered: Aug 2002
Location: 1210, ABK-D/L
Posts: 4029
na bei dem is es ned

string = string1.string2

sondern

string = string1+string2

!

XeroXs

doh
Avatar
Registered: Nov 2000
Location: Lieboch
Posts: 10334
das hab ich eh schon vorher geschrieben? :)

moidaschl

Vollzeit-Hackler
Avatar
Registered: Aug 2002
Location: 1210, ABK-D/L
Posts: 4029
ah ja da gibts doch auch die funktion oda?

xx = StrToFloat(wwi);

braucht ma ja dann fürs rechnen!
oda?

wwi so zb:

trash = StrToFloat(Output->Text);

XeroXs

doh
Avatar
Registered: Nov 2000
Location: Lieboch
Posts: 10334
ja, auch wenn ich nicht genau weiß wie du darauf jetzt kommst.. egal :)

geht übrigens auch mit .todouble()

also

float bla;
bla = Output->Text.ToDouble()

XeroXs

doh
Avatar
Registered: Nov 2000
Location: Lieboch
Posts: 10334
zum String nochmal...

AnsiString variablenname;

da brauchst dann auch nix includen..

moidaschl

Vollzeit-Hackler
Avatar
Registered: Aug 2002
Location: 1210, ABK-D/L
Posts: 4029
sehr gut :)

danke !

XeroXs

doh
Avatar
Registered: Nov 2000
Location: Lieboch
Posts: 10334
und weilst ja des float dann wieder umwandeln wollen wirst

einfach

Output->Text=AnsiString(float-variable);

moidaschl

Vollzeit-Hackler
Avatar
Registered: Aug 2002
Location: 1210, ABK-D/L
Posts: 4029
jap :)

ich habs jetz so:

Code:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"

int wt;
float Erg=0, trash=0;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TCalc *Calc;
//---------------------------------------------------------------------------
__fastcall TCalc::TCalc(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TCalc::B1Click(TObject *Sender)
{
 Output->Text=Output->Text+"1";
}
//---------------------------------------------------------------------------
void __fastcall TCalc::B2Click(TObject *Sender)
{
 Output->Text=Output->Text+"2";
}
//---------------------------------------------------------------------------
void __fastcall TCalc::B3Click(TObject *Sender)
{
 Output->Text=Output->Text+"3";
}
//---------------------------------------------------------------------------
void __fastcall TCalc::B4Click(TObject *Sender)
{
 Output->Text=Output->Text+"4";
}
//---------------------------------------------------------------------------
void __fastcall TCalc::B5Click(TObject *Sender)
{
 Output->Text=Output->Text+"5";
}
//---------------------------------------------------------------------------
void __fastcall TCalc::B6Click(TObject *Sender)
{
 Output->Text=Output->Text+"6";
}
//---------------------------------------------------------------------------
void __fastcall TCalc::B7Click(TObject *Sender)
{
 Output->Text=Output->Text+"7";
}
//---------------------------------------------------------------------------
void __fastcall TCalc::B8Click(TObject *Sender)
{
 Output->Text=Output->Text+"8";
}
//---------------------------------------------------------------------------
void __fastcall TCalc::B9Click(TObject *Sender)
{
 Output->Text=Output->Text+"9";
}
//---------------------------------------------------------------------------

void __fastcall TCalc::BaddClick(TObject *Sender)
{
 trash = trash + StrToFloat(Output->Text);
 Output -> Text = "";
 wt = 1;
}
//---------------------------------------------------------------------------
void __fastcall TCalc::BsubClick(TObject *Sender)
{
 trash = trash - StrToFloat(Output->Text);
 Output -> Text = "";
 wt = 2;
}
//---------------------------------------------------------------------------
void __fastcall TCalc::BergClick(TObject *Sender)
{
 if ( wt == 1 )
  {
   trash = trash + StrToFloat(Output->Text);
   Output -> Text = trash;
  }
 if ( wt == 2 )
  {
   trash = trash - StrToFloat(Output->Text);
   Output -> Text = trash;
  }


}
//---------------------------------------------------------------------------


des is nurmal add und sub!
Kontakt | Unser Forum | Über overclockers.at | Impressum | Datenschutz