void CIF语句Dlg::OnBnClickedOk()
{
CString str;
CWnd* wnd;
wnd = GetDlgItem(IDC_EDIT1);
wnd->GetWindowText(str);
DOUBLE weight = 0.0;
DOUBLE price = 0.0;
weight = _tstof(str);
if (weight <= 50)
{
price = 0.25 * weight;
}
else if (weight <= 100)
{
price = 0.25 * 50 + 0.35 * (weight - 50);
}
else
{
price = 0.25 * 50 + 0.35 * 50 + (weight - 100);
}
CWnd* wnd2;
wnd2 = GetDlgItem(IDC_EDIT2);
CString strPrice;
strPrice.Format(_T("%lf"), price);
wnd2->SetWindowText(strPrice);
}
EDIT的读写,获取与写入
于 2024-03-02 10:24:50 首次发布