|
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit12.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
m_sInput = "";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TButton *pBtn =(TButton*)Sender;
m_sInput += pBtn->Caption;
Panel3->Caption = m_sInput;
Panel3->Font->Color = clRed;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button123Click(TObject *Sender)
{
Panel3->Caption = m_sInput;
m_sInput = "";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button12Click(TObject *Sender)
{
m_sValue = m_sInput;
m_sInput = "";
Panel3->Caption = m_sInput;
m_sOper = "+";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button15Click(TObject *Sender)
{
double iValue1 = m_sInput.ToIntDef(0);
double iValue2 = m_sValue.ToIntDef(0);
double iCalc;
if (m_sOper == "+") iCalc = iValue1 + iValue2;
else if(m_sOper == "-") iCalc = iValue1 - iValue2;
else if(m_sOper == "*") iCalc = iValue1 * iValue2;
else if(m_sOper == "/") iCalc = iValue2 / iValue1;
Panel3->Caption = iCalc;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button13Click(TObject *Sender)
{
m_sValue = m_sInput;
m_sInput = "";
Panel3->Caption = m_sInput;
m_sOper = "-";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button14Click(TObject *Sender)
{
m_sValue = m_sInput;
m_sInput = "";
Panel3->Caption =m_sInput;
m_sOper = "*";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button17Click(TObject *Sender)
{
m_sValue = m_sInput;
m_sInput = "";
Panel3->Caption =m_sInput;
m_sOper = "/";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button11Click(TObject *Sender)
{
m_sInput = m_sInput.SubString(1,m_sInput.Length()-1);
Panel3->Caption = m_sInput;
}
//---------------------------------------------------------------------------
볼랜드 6.0으로 하고 있는데 소수점 까지 계산을 할려고 하는데 어떻게 해야될지좀 알려 줗세요
|