#include <vcl.h>
#include <vcl/dstring.h>
#pragma hdrstop
#include "Unit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
class Dichte
{
private:
float Gewicht;
float Volumen;
AnsiString Name;
public:
float vDichte;
Dichte()
{
vDichte = 0;
Gewicht = 0;
Volumen = 0;
Name = "";
}
void reset()
{
vDichte = 0;
Gewicht = 0;
Volumen = 0;
Name = "Test";
}
void Dichte_errechnen()
{
InputQuery("Volumen des Stoffs","Dichte",Volumen);
InputQuery("Masse des Stoffs","Dichte",Gewicht);
vDichte = Gewicht/Volumen;
}
};
TForm1 *Form1;
Dichte Stoff;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Beenden1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Dichteneu1Click(TObject *Sender)
{
PDichte->Caption = "";
EName->Text = "";
Stoff.reset();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Dichteerrechnen1Click(TObject *Sender)
{
Stoff.Dichte_errechnen();
}
//---------------------------------------------------------------------------