📄 interestcomputedlg.cpp
字号:
// InterestComputeDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MoneyAnyWhere.h"
#include "InterestComputeDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInterestComputeDlg dialog
CInterestComputeDlg::CInterestComputeDlg(CWnd* pParent /*=NULL*/)
: CDialog(CInterestComputeDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CInterestComputeDlg)
m_strBaseMoney = _T("0");
m_strInterest = _T("");
m_strInterestRate = _T("0.");
m_strLength = _T("0");
m_strSum = _T("");
//}}AFX_DATA_INIT
}
void CInterestComputeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInterestComputeDlg)
DDX_Text(pDX, IDC_EDIT_BASEMONEY, m_strBaseMoney);
DDX_Text(pDX, IDC_EDIT_INTEREST, m_strInterest);
DDX_Text(pDX, IDC_EDIT_INTERESTRATE, m_strInterestRate);
DDX_Text(pDX, IDC_EDIT_LENGTH, m_strLength);
DDX_Text(pDX, IDC_EDIT_SUM, m_strSum);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInterestComputeDlg, CDialog)
//{{AFX_MSG_MAP(CInterestComputeDlg)
ON_BN_CLICKED(IDC_BTN_CAL, OnBtnCal)
ON_BN_CLICKED(IDC_BTN_CLS, OnBtnCls)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInterestComputeDlg message handlers
void CInterestComputeDlg::OnBtnCal()
{
UpdateData(true);
float fBaseMoney,fInterest,fInterestRate,fSum;
int iLength;
char * test;
char Buffer[256];
for(int i=0;i<m_strBaseMoney.GetLength();i++)
{
Buffer[i]=m_strBaseMoney.GetAt(i);
}
test=&Buffer[0];
fBaseMoney = atof(test);
for(i=0;i<m_strInterestRate.GetLength();i++)
{
Buffer[i]=m_strInterestRate.GetAt(i);
}
test=&Buffer[0];
fInterestRate = atof(test);
if(fInterestRate>1)
fInterestRate = fInterestRate/100;
iLength = _wtoi(m_strLength);
fInterest = fBaseMoney * fInterestRate * iLength;
fSum = fBaseMoney + fInterest;
m_strInterest.Format(L"%.2f",fInterest);
m_strSum.Format(L"%.2f",fSum);
UpdateData(false);
// TODO: Add your control notification handler code here
}
void CInterestComputeDlg::OnBtnCls()
{
CDialog::OnOK();
// TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -