void CMyDlg::OnCal()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if (m_num2==0)
{
AfxMessageBox("输入错误!"); } else {
m_num3 = m_num1/m_num2;
//CString str;
//str.Format("计算结果是:%d",m_num3);
//AfxMessageBox(str);
UpdateData(false);
}
}
上面这一段是确定按钮的函数代码,先简单的实现除法计算的问题。除数和被除数显示在Box里,现在想让计算结果显示在探出的对话框中,本来想用Afxmessagebox,可能中间没关联好,麻烦热心的朋友看一下,先谢过了。
{
// TODO: Add your control notification handler code here
UpdateData(true);
if (m_num2==0)
{
AfxMessageBox("输入错误!"); } else {
m_num3 = m_num1/m_num2;
//CString str;
//str.Format("计算结果是:%d",m_num3);
//AfxMessageBox(str);
UpdateData(false);
}
}
上面这一段是确定按钮的函数代码,先简单的实现除法计算的问题。除数和被除数显示在Box里,现在想让计算结果显示在探出的对话框中,本来想用Afxmessagebox,可能中间没关联好,麻烦热心的朋友看一下,先谢过了。
CString str;
str.Format("计算结果是:%d",m_num3);
AfxMessageBox(str);
你的m_num3这个是整形变量来的吧?如果是的话这个没错的啊
CString str;
str.Format("计算结果是:%d",m_num3);
::MessageBox(NULL,"显示数据",str,MB_OK);