⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test1dlg.cpp

📁 本人设计的一个漂亮科学计算器
💻 CPP
📖 第 1 页 / 共 4 页
字号:
	InsertStr += ")=";
	InsertStr += str;
	m_pList->m_list.InsertString(0,InsertStr);

	m_str1="";
}	

void CTest1Dlg::OnAcos() 
{
	// TODO: Add your control notification handler code here
	CString InsertStr("");
	CString str;

	int aa=GetCheckedRadioButton(IDC_ANGLE,IDC_RADIAN);
	if(aa==1023)
	{
		m_show=acos(atof(m_str1));  
		m_show=m_show*180/3.141592653589793238;
	}
	if(aa==1024)
	{
		m_show=acos(atof(m_str1));	
	}
	UpdateData(FALSE);

	str.Format("%lf",m_show);
	InsertStr += "acos(";
	InsertStr += m_str1;
	InsertStr += ")=";
	InsertStr += str;
	m_pList->m_list.InsertString(0,InsertStr);

	m_str1="";  
}

void CTest1Dlg::OnMod() 
{
	// TODO: Add your control notification handler code here
	m_judown=TRUE;
	m_str2=m_str1;
	m_str1="";
	m_judown=FALSE;
	m_str3="%";
}



void CTest1Dlg::OnLn() 
{
	// TODO: Add your control notification handler code here
	if(m_str1!="")
	{
		CString InsertStr("");
		CString str;

		m_show=log(atof(m_str1));
		UpdateData(FALSE);

		str.Format("%lf",m_show);
		InsertStr += "ln(";
		InsertStr += m_str1;
		InsertStr += ")=";
		InsertStr += str;
		m_pList->m_list.InsertString(0,InsertStr);

		m_str1=""; 
	}
}

void CTest1Dlg::OnSqrt() 
{
	// TODO: Add your control notification handler code here
	if(m_str1!="")
	{
		CString InsertStr("");
		CString str;

		m_show=sqrt(atof(m_str1));
		UpdateData(FALSE);

		str.Format("%lf",m_show);
		InsertStr += "Sqrt(";
		InsertStr += m_str1;
		InsertStr += ")=";
		InsertStr += str;
		m_pList->m_list.InsertString(0,InsertStr);

		m_str1="";
	}	
}



void CTest1Dlg::OnLog() 
{
	// TODO: Add your control notification handler code here
	if(m_str1!="")
	{
		CString InsertStr("");
		CString str;

		m_show=log10(atof(m_str1));
		UpdateData(FALSE);

		str.Format("%lf",m_show);
		InsertStr += "log(";
		InsertStr += m_str1;
		InsertStr += ")=";
		InsertStr += str;
		m_pList->m_list.InsertString(0,InsertStr);

		m_str1=""; 
	}
}

void CTest1Dlg::OnHex() 
{
	// TODO: Add your control notification handler code here
	CWnd* pWnd = this->GetDlgItem(IDC_SIN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_COS);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_ASIN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_ACOS);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_SQRT);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_LN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_LOG);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_MOD);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_NUM8);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM9);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM7);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM6);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM5);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM4);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM3);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM2);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_CHAR_A);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_CHAR_B);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_CHAR_C);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_CHAR_D);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_CHAR_E);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_CHAR_F);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_TAN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_ATAN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_EXP);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_INT);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_SQUARE);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CUBE);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_INDEX);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_ABS);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_RECIPROCAL);
	pWnd->EnableWindow(FALSE);

	if(m_jucle==TRUE)
	{
		m_str4="";
		m_str4=m_str1;
		m_str1="";
		m_jucle=FALSE;  
	}
	if(m_ju16==TRUE)
	{
		if(10==m_nsel)
		{
			m_str4.Format("%X",(int)atof(m_str4));
			SetDlgItemText(IDC_SHOW_RESULT,m_str4);
		}

		if(8==m_nsel)
		{
			double bb=0;
			for(int i=0;i<=m_str4.GetLength()-1;i++)
			{
				bb+=(m_str4[i]-48.0)*pow(8.0,(double)(m_str4.GetLength()-i-1));
			}
			m_str4.Format("%X",(int)bb);
			SetDlgItemText(IDC_SHOW_RESULT,m_str4);
		}

		if(2==m_nsel)
		{
			double bb=0;
			for(int i=0;i<=m_str4.GetLength()-1;i++)
			{
				bb+=(m_str4[i]-48.0)*pow(2.0,(double)(m_str4.GetLength()-i-1));
			}
			m_str4.Format("%X",(int)bb);
			SetDlgItemText(IDC_SHOW_RESULT,m_str4);
		}

		m_nsel=16;
		m_ju16=FALSE;  m_ju10=TRUE;  m_ju8=TRUE;  m_ju2=TRUE;
	}

}

void CTest1Dlg::OnDecimal() 
{
	// TODO: Add your control notification handler code here
	CWnd* pWnd = this->GetDlgItem(IDC_SIN);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_COS);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_ASIN);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_ACOS);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_SQRT);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_LN);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_LOG);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_MOD);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM8);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM9);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM7);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM6);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM5);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM4);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM3);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM2);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_CHAR_A);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CHAR_B);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CHAR_C);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CHAR_D);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CHAR_E);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CHAR_F);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_TAN);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_ATAN);  
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_EXP);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_INT);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_SQUARE);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_CUBE);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_INDEX);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_ABS);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_RECIPROCAL);
	pWnd->EnableWindow(TRUE);

	if(m_jucle)
	{
		m_str4="";
		m_str4=m_str1;
		m_str1="";
		m_jucle=FALSE;
	}

	if(m_ju10==TRUE)
	{
		if(16==m_nsel)
		{
			double bb=0;
			for(int i=0;i<=m_str4.GetLength()-1;i++)
			{
				double pp=0;
				if(m_str4[i]>=65 && m_str4[i]<=70)
				{
					pp=m_str4[i]-55.0;
				}
				else
					pp=m_str4[i]-48.0;
				bb+=pp*pow(16.0,(double)(m_str4.GetLength()-i-1));
			}
			m_str4.Format("%d",(int)bb);
			SetDlgItemText(IDC_SHOW_RESULT,m_str4);
		}

		if(8==m_nsel)
		{
			double bb=0;
			for(int i=0;i<=m_str4.GetLength()-1;i++)
			{
				bb+=(m_str4[i]-48.0)*pow(8.0,(double)(m_str4.GetLength()-i-1));
			}
			m_str4.Format("%d",(int)bb);
			SetDlgItemText(IDC_SHOW_RESULT,m_str4);
		}

		if(2==m_nsel)
		{  
			double bb=0;
			for(int i=0;i<=m_str4.GetLength()-1;i++)
			{
				bb+=(m_str4[i]-48.0)*pow(2.0,(double)(m_str4.GetLength()-i-1));
			}
			m_str4.Format("%d",(int)bb);
			SetDlgItemText(IDC_SHOW_RESULT,m_str4);
		}

		m_nsel=10;
		m_ju16=TRUE;  m_ju10=FALSE;  m_ju8=TRUE;  m_ju2=TRUE;
	}  
}

void CTest1Dlg::OnOctal() 
{
	// TODO: Add your control notification handler code here
	CWnd* pWnd = this->GetDlgItem(IDC_SIN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_COS);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_ASIN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_ACOS);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_SQRT);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_LN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_LOG);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_MOD);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_NUM8);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_NUM9);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_NUM7);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM6);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM5);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM4);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM3);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_NUM2);
	pWnd->EnableWindow(TRUE);

	pWnd = this->GetDlgItem(IDC_CHAR_A);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CHAR_B);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CHAR_C);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CHAR_D);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CHAR_E);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CHAR_F);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_TAN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_ATAN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_EXP);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_INT);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_SQUARE);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_CUBE);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_INDEX);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_ABS);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_RECIPROCAL);
	pWnd->EnableWindow(FALSE);


	if(m_jucle==TRUE)
	{
		m_str4="";
		m_str4=m_str1;
		m_str1="";
		m_jucle=FALSE;  
	}

	if(m_ju8==TRUE)
	{
		if(10==m_nsel)
		{
			m_str4.Format("%o",(int)atof(m_str4));
			SetDlgItemText(IDC_SHOW_RESULT,m_str4);
		}

		if(16==m_nsel)
		{
			double bb=0;
			for(int i=0;i<=m_str4.GetLength()-1;i++)
			{
				double pp=0;
				if(m_str4[i]>=65 && m_str4[i]<=70)
					pp=m_str4[i]-55.0;
				else
					pp=m_str4[i]-48.0;
				bb+=pp*pow(16.0,(double)(m_str4.GetLength()-i-1));
			}
			m_str4.Format("%o",(int)bb);
			SetDlgItemText(IDC_SHOW_RESULT,m_str4);
		}

		if(2==m_nsel)
		{
			double bb=0;
			for(int i=0;i<=m_str4.GetLength()-1;i++)
			{
				bb+=(m_str4[i]-48.0)*pow(2.0,(double)(m_str4.GetLength()-i-1));
			}
			m_str4.Format("%o",(int)bb);
			SetDlgItemText(IDC_SHOW_RESULT,m_str4);
		}

		m_nsel=8;
		m_ju16=TRUE;  m_ju10=TRUE;  m_ju8=FALSE;  m_ju2=TRUE;
	}
}

void CTest1Dlg::OnBinary() 
{
	// TODO: Add your control notification handler code here
	CWnd* pWnd = this->GetDlgItem(IDC_SIN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_COS);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_ASIN);
	pWnd->EnableWindow(FALSE);

	pWnd = this->GetDlgItem(IDC_ACOS);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -