//---------------------------------------------------------------------------
#include <
vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
double zahly (double a, double b)
{
double c;
double r1 = a;
double r2 = b;
if (Form1->ComboBox1->Text=="kOhm")
{
r1 = r1 * 1000;
}
if (Form1->ComboBox1->Text=="MOhm")
{
r1 = r1 * 1000000;
}
if (Form1->ComboBox2->Text=="kOhm")
{
r2 = r2 * 1000;
}
if (Form1->ComboBox2->Text=="MOhm")
{
r2 = r2 * 1000000;
}
c= 1/((1/a)+(1/b));
return(c);
}
#pragma
package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
Form2->Show();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Form1->Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
double r1, r2, rg;
r1= StrToFloat(Edit1->Text);
r2= StrToFloat(Edit2->Text);
rg= zahly(r1, r2);
//rg= (r1*r2)/ (r1+r2);
Edit3->Text = FloatToStr(rg);
//Edit3->Text= FloatToStr(zahly(StrToFloat(Edit1->Text), StrToFloat(Edit2->Text)));
}
//---------------------------------------------------------------------------