`#include <vcl.h>
//---------------------------------------------------------------------------
TForm1 *Form1;
double Zbroj(double a, double b); double Razlika(double a, double b); double Umnozak(double a, double b); double Kolicnik(double a, double b); double a, b; char zbrajanje, oduzimanje, mnozenje, dijeljenje;
//--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {
} //---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender) { Cal->Text=Cal->Text+1; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender) { Cal->Text=Cal->Text+2; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender) { Cal->Text=Cal->Text+3; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button8Click(TObject *Sender) { Cal->Text=Cal->Text+4; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender) { Cal->Text=Cal->Text+5; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click(TObject *Sender) { Cal->Text=Cal->Text+6; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender) { Cal->Text=Cal->Text+7; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button10Click(TObject *Sender) { Cal->Text=Cal->Text+8; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button9Click(TObject *Sender) { Cal->Text=Cal->Text+9; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender) { Cal->Text=Cal->Text+0; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button15Click(TObject *Sender) { if(Cal->Text.Length()== 0){ ShowMessage("Niste upisali brojeve!");
}
if(zbrajanje==true){
b=Cal->Text.ToDouble();
a=Zbroj(a, b);
Cal->Text=a;
a=0;
b=0;
}
if(oduzimanje==true){
b=Cal->Text.ToDouble();
a=Razlika(a, b);
Cal->Text=a;
a=0;
b=0;
}
if(mnozenje==true){
b=Cal->Text.ToDouble();
a=Umnozak(a, b);
Cal->Text=a;
a=0;
b=0;
}
if(dijeljenje==true){
b=Cal->Text.ToDouble();
a=Kolicnik(a, b);
Cal->Text=a;
a=0;
b=0;
}
} //---------------------------------------------------------------------------
void __fastcall TForm1::Button11Click(TObject *Sender) { if(zbrajanje==true){ b=Cal->Text.ToDouble(); a=Zbroj(a, b); Cal->Text=""; } else a=Cal->Text.ToDouble(); zbrajanje=true; Cal->Clear(); mnozenje=false; dijeljenje=false; oduzimanje=false; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button12Click(TObject *Sender) { if(oduzimanje==true){ b=Cal->Text.ToDouble(); a=Razlika(a, b); Cal->Text=""; } else a=Cal->Text.ToDouble(); oduzimanje=true; Cal->Clear(); mnozenje=false; dijeljenje=false; zbrajanje=false; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button13Click(TObject *Sender) { if(mnozenje==true){ b=Cal->Text.ToDouble(); a=Umnozak(a, b); Cal->Text=""; } else a=Cal->Text.ToDouble(); mnozenje=true; Cal->Clear(); zbrajanje=false; dijeljenje=false; oduzimanje=false; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button14Click(TObject *Sender) { if(dijeljenje==true && b!= 0){ b=Cal->Text.ToDouble(); a=Kolicnik(a, b); Cal->Text=""; } else a=Cal->Text.ToDouble(); dijeljenje=true; Cal->Clear(); mnozenje=false; zbrajanje=false; oduzimanje=false; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button16Click(TObject *Sender) { Cal->Clear(); a=0; b=0; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button17Click(TObject *Sender) { Cal->Text=Cal->Text+','; } //---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject Sender, TCloseAction &Action) { TIniFile ini = new TIniFile(GetCurrentDir() + "\settings.ini"); ini->WriteInteger("Main Window", "Left", Left); ini->WriteInteger("Main Window", "Top", Top); ini->WriteInteger("Font", "FontSize", FontSize);
delete ini;
} //---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject Sender) { TIniFile ini = new TIniFile(GetCurrentDir() + "\settings.ini"); Left=ini->ReadInteger("Main Window", "Left", 0); Top=ini->ReadInteger("Main Window", "Top", 0); FontSize=ini->ReadInteger("Font","FontType",15);
delete ini;
} //---------------------------------------------------------------------------
void __fastcall TForm1::Button18Click(TObject Sender){ const CROATIAN=(SUBLANG_CROATIAN_CROATIA << 10) | LANG_CROATIAN; if(LoadNewResourceModule(CROATIAN)){ ReinitializeForms(); TIniFile ini = new TIniFile(GetCurrentDir() + "\settings.ini"); Left=ini->ReadInteger("Main Window", "Left", 0); Top=ini->ReadInteger("Main Window", "Top", 0);
delete ini;
}
} //---------------------------------------------------------------------------
void __fastcall TForm1::Button19Click(TObject Sender){ const ENGLISH=(SUBLANG_ENGLISH_UK << 10) | LANG_ENGLISH; if(LoadNewResourceModule(ENGLISH)){ ReinitializeForms(); TIniFile ini = new TIniFile(GetCurrentDir() + "\settings.ini"); Left=ini->ReadInteger("Main Window", "Left", 0); Top=ini->ReadInteger("Main Window", "Top", 0);
delete ini;
}
} //---------------------------------------------------------------------------`
I know, the .ini is for nothing lol