📄 test1dlg.cpp
字号:
}
else
{
if(!m_firstdown)
{
m_str1=m_str1.Left(m_str1.GetLength()-1);
m_firstdown=TRUE;
}
m_str1+="6";
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
m_jucle=TRUE;
int aa=GetCheckedRadioButton(IDC_HEX,IDC_BINARY);
switch(aa)
{
case 1029:
m_nsel=16; break;
case 1030:
m_nsel=10; break;
case 1031:
m_nsel=8; break;
case 1032:
m_nsel=2; break;
}
}
}
void CTest1Dlg::OnNum7()
{
// TODO: Add your control notification handler code here
if(!m_judown)
{
if(!m_juexp)
{
m_str1+="7";
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
else
{
if(!m_firstdown)
{
m_str1=m_str1.Left(m_str1.GetLength()-1);
m_firstdown=TRUE;
}
m_str1+="7";
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
m_jucle=TRUE;
int aa=GetCheckedRadioButton(IDC_HEX,IDC_BINARY);
switch(aa)
{
case 1029:
m_nsel=16; break;
case 1030:
m_nsel=10; break;
case 1031:
m_nsel=8; break;
case 1032:
m_nsel=2; break;
}
}
}
void CTest1Dlg::OnNum8()
{
// TODO: Add your control notification handler code here
if(!m_judown)
{
if(!m_juexp)
{
m_str1+="8";
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
else
{
if(!m_firstdown)
{
m_str1=m_str1.Left(m_str1.GetLength()-1);
m_firstdown=TRUE;
}
m_str1+="8";
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
m_jucle=TRUE;
int aa=GetCheckedRadioButton(IDC_HEX,IDC_BINARY);
switch(aa)
{
case 1029:
m_nsel=16; break;
case 1030:
m_nsel=10; break;
case 1031:
m_nsel=8; break;
case 1032:
m_nsel=2; break;
}
}
}
void CTest1Dlg::OnNum9()
{
// TODO: Add your control notification handler code here
if(!m_judown)
{
if(!m_juexp)
{
m_str1+="9";
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
else
{
if(!m_firstdown)
{
m_str1=m_str1.Left(m_str1.GetLength()-1);
m_firstdown=TRUE;
}
m_str1+="9";
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
m_jucle=TRUE;
int aa=GetCheckedRadioButton(IDC_HEX,IDC_BINARY);
switch(aa)
{
case 1029:
m_nsel=16; break;
case 1030:
m_nsel=10; break;
case 1031:
m_nsel=8; break;
case 1032:
m_nsel=2; break;
}
}
}
void CTest1Dlg::OnNum0()
{
// TODO: Add your control notification handler code here
if(!m_judown)
{
if(!m_juexp)
{
m_str1+="0";
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
else
{
if(!m_firstdown)
{
m_str1=m_str1.Left(m_str1.GetLength()-1);
m_firstdown=TRUE;
}
m_str1+="0";
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
m_jucle=TRUE;
int aa=GetCheckedRadioButton(IDC_HEX,IDC_BINARY);
switch(aa)
{
case 1029:
m_nsel=16; break;
case 1030:
m_nsel=10; break;
case 1031:
m_nsel=8; break;
case 1032:
m_nsel=2; break;
}
}
}
void CTest1Dlg::OnAdd()
{
// TODO: Add your control notification handler code here
if(m_str1!="")
{
m_judown=TRUE;
m_str2=m_str1;
m_str1="";
m_judown=FALSE;
m_str3="+";
}
if(m_str1=="" && m_str2=="" && m_str3=="")
{
m_judown=TRUE;
m_str2=m_str5;
m_str5="";
m_judown=FALSE;
m_str3="+";
}
}
void CTest1Dlg::OnPlus()
{
// TODO: Add your control notification handler code here
if(m_str1!="")
{
m_judown=TRUE;
m_str2=m_str1;
m_str1="";
m_judown=FALSE;
m_str3="-";
}
if(m_str1=="" && m_str2=="" && m_str3=="")
{
m_judown=TRUE;
m_str2=m_str5;
m_str5="";
m_judown=FALSE;
m_str3="-";
}
}
void CTest1Dlg::OnMul()
{
// TODO: Add your control notification handler code here
if(m_str1!="")
{
m_judown=TRUE;
m_str2=m_str1;
m_str1="";
m_judown=FALSE;
m_str3="*";
}
if(m_str1=="" && m_str2=="" && m_str3=="")
{
m_judown=TRUE;
m_str2=m_str5;
m_str5="";
m_judown=FALSE;
m_str3="*";
}
}
void CTest1Dlg::OnDiv()
{
// TODO: Add your control notification handler code here
if(m_str1!="")
{
m_judown=TRUE;
m_str2=m_str1;
m_str1="";
m_judown=FALSE;
m_str3="/";
}
if(m_str1=="" && m_str2=="" && m_str3=="")
{
m_judown=TRUE;
m_str2=m_str5;
m_str5="";
m_judown=FALSE;
m_str3="/";
}
}
void CTest1Dlg::OnEqu()
{
// TODO: Add your control notification handler code here
CString InsertStr("");
// m_pList->m_list.InsertString(0,str);
if(m_str3=="+")
{
m_show=atof(m_str1)+atof(m_str2);
UpdateData(FALSE);
m_str5.Format("%lf",m_show);
InsertStr += m_str2;
InsertStr += m_str3;
if(atof(m_str1)<0)
InsertStr +="(";
InsertStr += m_str1;
if(atof(m_str1)<0)
InsertStr +=")";
InsertStr += "=";
InsertStr += m_str5;
m_pList->m_list.InsertString(0,InsertStr);
m_str1=m_str2=m_str3="";
}
if(m_str3=="-")
{
m_show=atof(m_str2)-atof(m_str1);
UpdateData(FALSE);
m_str5.Format("%lf",m_show);
InsertStr += m_str2;
InsertStr += m_str3;
if(atof(m_str1)<0)
InsertStr +="(";
InsertStr += m_str1;
if(atof(m_str1)<0)
InsertStr +=")";
InsertStr += "=";
InsertStr += m_str5;
m_pList->m_list.InsertString(0,InsertStr);
m_str1=m_str2=m_str3="";
}
if(m_str3=="*")
{
m_show=atof(m_str2)*atof(m_str1);
UpdateData(FALSE);
m_str5.Format("%lf",m_show);
InsertStr += m_str2;
InsertStr += m_str3;
if(atof(m_str1)<0)
InsertStr +="(";
InsertStr += m_str1;
if(atof(m_str1)<0)
InsertStr +=")";
InsertStr += "=";
InsertStr += m_str5;
m_pList->m_list.InsertString(0,InsertStr);
m_str1=m_str2=m_str3="";
}
if(m_str3=="/")
{
m_show=atof(m_str2)/atof(m_str1);
UpdateData(FALSE);
m_str5.Format("%lf",m_show);
InsertStr += m_str2;
InsertStr += m_str3;
if(atof(m_str1)<0)
InsertStr +="(";
InsertStr += m_str1;
if(atof(m_str1)<0)
InsertStr +=")";
InsertStr += "=";
InsertStr += m_str5;
m_pList->m_list.InsertString(0,InsertStr);
m_str1=m_str2=m_str3="";
}
if(m_str3=="%")
{
CString InsertStr("");
CString str;
if(m_str1!="" && m_str2!="")
{
m_show=fmod(atof(m_str2),atof(m_str1));
UpdateData(FALSE);
str.Format("%lf",m_show);
InsertStr += m_str2;
InsertStr += "mod";
InsertStr += m_str1;
InsertStr += "=";
InsertStr += str;
m_pList->m_list.InsertString(0,InsertStr);
m_str1=m_str2=m_str3="";
}
}
if(m_str3=="exp")
{
m_show=atof(m_str2)*pow(10.0,atof(m_str1.Right(m_str1.GetLength()-m_str2.GetLength()-3)));
UpdateData(FALSE);
CString str("");
InsertStr+=m_str2;
InsertStr+=".e+";
InsertStr+=m_str1.Right(m_str1.GetLength()-m_str2.GetLength()-3);
InsertStr+="=";
str.Format("%lf",m_show);
InsertStr+=str;
m_pList->m_list.InsertString(0,InsertStr);
m_str1=m_str2=m_str3="";
m_firstdown=m_juexp=FALSE;
}
if(m_str3=="x^y")
{
m_show=pow(atof(m_str2),atof(m_str1));
UpdateData(FALSE);
InsertStr+=m_str2;
InsertStr+="^";
InsertStr+=m_str1;
InsertStr+="=";
CString str("");
str.Format("%lf",m_show);
InsertStr+=str;
m_pList->m_list.InsertString(0,InsertStr);
m_str1=m_str2=m_str3="";
}
}
void CTest1Dlg::OnPoint()
{
// TODO: Add your control notification handler code here
if(!m_judown)
{
BOOL juPointDown=FALSE;
if(m_str1!="")
{
for(int i=0;i<m_str1.GetLength();i++)
{
if(m_str1[i]=='.')
juPointDown=TRUE;
}
if(!juPointDown)
m_str1+=".";
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
else
SetDlgItemText(IDC_SHOW_RESULT,"0");
}
}
void CTest1Dlg::OnSign()
{
// TODO: Add your control notification handler code here
if(atof(m_str1)>0)
{
CString str;
str=m_str1;
m_str1="";
m_str1+="-";
m_str1+=str;
}
else if(atof(m_str1)<0)
{
m_str1=m_str1.Right(m_str1.GetLength()-1);
}
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
void CTest1Dlg::OnBackspace()
{
// TODO: Add your control notification handler code here
if(m_str1!="")
{
if(1!=m_str1.GetLength())
{
m_str1=m_str1.Left(m_str1.GetLength()-1);
SetDlgItemText(IDC_SHOW_RESULT,m_str1);
}
else
{
m_str1=m_str1.Left(m_str1.GetLength()-1);
SetDlgItemText(IDC_SHOW_RESULT,"0");
}
}
}
void CTest1Dlg::OnClear()
{
// TODO: Add your control notification handler code here
m_str1=m_str2=m_str3=m_str4="";
m_str5="";
m_juexp=m_firstdown=FALSE;
SetDlgItemText(IDC_SHOW_RESULT,"0");
}
void CTest1Dlg::OnSin()
{
// TODO: Add your control notification handler code here
CString InsertStr("");
CString str;
int aa=GetCheckedRadioButton(IDC_ANGLE,IDC_RADIAN);
if(aa==1023)
{
m_show=sin(atof(m_str1)*3.141592653589793238/180);
}
if(aa==1024)
{
m_show=sin(atof(m_str1));
}
UpdateData(FALSE);
str.Format("%lf",m_show);
InsertStr += "sin(";
InsertStr += m_str1;
InsertStr += ")=";
InsertStr += str;
m_pList->m_list.InsertString(0,InsertStr);
m_str1="";
}
void CTest1Dlg::OnCos()
{
// TODO: Add your control notification handler code here
CString InsertStr("");
CString str;
int aa=GetCheckedRadioButton(IDC_ANGLE,IDC_RADIAN);
if(aa==1023)
{
m_show=cos(atof(m_str1)*3.141592653589793238/180);
}
if(aa==1024)
{
m_show=cos(atof(m_str1));
}
UpdateData(FALSE);
str.Format("%lf",m_show);
InsertStr += "cos(";
InsertStr += m_str1;
InsertStr += ")=";
InsertStr += str;
m_pList->m_list.InsertString(0,InsertStr);
m_str1="";
}
void CTest1Dlg::OnAsin()
{
// TODO: Add your control notification handler code here
CString InsertStr("");
CString str;
int aa=GetCheckedRadioButton(IDC_ANGLE,IDC_RADIAN);
if(aa==1023)
{
m_show=asin(atof(m_str1));
m_show=m_show*180/3.141592653589793238;
}
if(aa==1024)
{
m_show=asin(atof(m_str1));
}
UpdateData(FALSE);
str.Format("%lf",m_show);
InsertStr += "asin(";
InsertStr += m_str1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -