219 lines
6.1 KiB
C++
219 lines
6.1 KiB
C++
//---------------------------------------------------------------------------
|
|
|
|
#include <vcl.h>
|
|
#pragma hdrstop
|
|
|
|
#include "Unit3.h"
|
|
//---------------------------------------------------------------------------
|
|
#pragma package(smart_init)
|
|
#pragma resource "*.dfm"
|
|
TForm3 *Form3;
|
|
//---------------------------------------------------------------------------
|
|
__fastcall TForm3::TForm3(TComponent* Owner)
|
|
: TForm(Owner)
|
|
{
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
void __fastcall TForm3::Button10Click(TObject *Sender)
|
|
{
|
|
Edit1->Text=Edit1->Text+0;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button7Click(TObject *Sender)
|
|
{
|
|
Edit1->Text=Edit1->Text+1;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button8Click(TObject *Sender)
|
|
{
|
|
Edit1->Text=Edit1->Text+2;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button9Click(TObject *Sender)
|
|
{
|
|
Edit1->Text=Edit1->Text+3;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button4Click(TObject *Sender)
|
|
{
|
|
Edit1->Text=Edit1->Text+4;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button5Click(TObject *Sender)
|
|
{
|
|
Edit1->Text=Edit1->Text+5;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button6Click(TObject *Sender)
|
|
{
|
|
Edit1->Text=Edit1->Text+6;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button1Click(TObject *Sender)
|
|
{
|
|
Edit1->Text=Edit1->Text+7;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button2Click(TObject *Sender)
|
|
{
|
|
Edit1->Text=Edit1->Text+8;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button3Click(TObject *Sender)
|
|
{
|
|
Edit1->Text=Edit1->Text+9;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button13Click(TObject *Sender)
|
|
{
|
|
if (mnozenie==true){
|
|
y=Edit1->Text.ToDouble();
|
|
x=x*y;
|
|
Edit1->Text="";
|
|
|
|
}
|
|
else{
|
|
x=Edit1->Text.ToDouble();
|
|
mnozenie=true;
|
|
Edit1->Clear();
|
|
dodawanie=false;
|
|
odejmowanie=false;
|
|
dzielenie=false;
|
|
przecinek=false;
|
|
|
|
}
|
|
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm3::Button12Click(TObject *Sender)
|
|
{
|
|
if (dzielenie==true){
|
|
y=Edit1->Text.ToDouble();
|
|
x=x/y;
|
|
Edit1->Text="";
|
|
|
|
}
|
|
else{
|
|
x=Edit1->Text.ToDouble();
|
|
dzielenie=true;
|
|
Edit1->Clear();
|
|
dodawanie=false;
|
|
odejmowanie=false;
|
|
mnozenie=false;
|
|
przecinek=false;
|
|
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm3::Button14Click(TObject *Sender)
|
|
{
|
|
if (dodawanie==true){
|
|
y=Edit1->Text.ToDouble();
|
|
x=x+y;
|
|
Edit1->Text="";
|
|
|
|
}
|
|
else{
|
|
x=Edit1->Text.ToDouble();
|
|
dodawanie=true;
|
|
Edit1->Clear();
|
|
mnozenie=false;
|
|
odejmowanie=false;
|
|
dzielenie=false;
|
|
przecinek=false;
|
|
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm3::Button15Click(TObject *Sender)
|
|
{
|
|
if (odejmowanie==true){
|
|
y=Edit1->Text.ToDouble();
|
|
x=x-y;
|
|
Edit1->Text="";
|
|
|
|
}
|
|
else{
|
|
x=Edit1->Text.ToDouble();
|
|
odejmowanie=true;
|
|
Edit1->Clear();
|
|
dodawanie=false;
|
|
mnozenie=false;
|
|
dzielenie=false;
|
|
przecinek=false;
|
|
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm3::Button16Click(TObject *Sender)
|
|
{
|
|
x=0;
|
|
y=0;
|
|
Edit1->Text="";
|
|
dodawanie=false;
|
|
odejmowanie=false;
|
|
mnozenie=false;
|
|
dzielenie=false;
|
|
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm3::Button17Click(TObject *Sender)
|
|
{
|
|
if(dodawanie==true){
|
|
y=Edit1->Text.ToDouble();
|
|
x=x+y;
|
|
Edit1->Text=x;
|
|
x=0;
|
|
y=0;
|
|
przecinek=false;
|
|
}
|
|
if(odejmowanie==true){
|
|
y=Edit1->Text.ToDouble();
|
|
x=x-y;
|
|
Edit1->Text=x;
|
|
x=0;
|
|
y=0;
|
|
przecinek=false;
|
|
}
|
|
if(mnozenie==true){
|
|
y=Edit1->Text.ToDouble();
|
|
x=x*y;
|
|
Edit1->Text=x;
|
|
x=0;
|
|
y=0;
|
|
przecinek=false;
|
|
}
|
|
if(dzielenie==true){
|
|
y=Edit1->Text.ToDouble();
|
|
x=x/y;
|
|
Edit1->Text=x;
|
|
x=0;
|
|
y=0;
|
|
przecinek=false;
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm3::Button11Click(TObject *Sender)
|
|
{
|
|
if (!przecinek){
|
|
AnsiString cyfra=Edit1->Text;
|
|
cyfra+=',';
|
|
Edit1->Text=cyfra;
|
|
przecinek=true;
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|