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

📄 dlglinearequa.cpp

📁 Calculator program written by DLLs with the math algorithms such as automata and can draw some simpl
💻 CPP
字号:
// DlgLinearEqua.cpp : implementation file
//

#include "stdafx.h"
#include "CalculatorGUI.h"
#include "DlgLinearEqua.h"
#include "Lib/PhuongTrinh.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgLinearEqua dialog


CDlgLinearEqua::CDlgLinearEqua(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgLinearEqua::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgLinearEqua)
	m_vA = _T("");
	m_vB = _T("");
	m_vX = _T("");
	m_vKQ = _T("");
	//}}AFX_DATA_INIT
}


void CDlgLinearEqua::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgLinearEqua)
	DDX_Text(pDX, IDC_EDIT_A, m_vA);
	DDX_Text(pDX, IDC_EDIT_B, m_vB);
	DDX_Text(pDX, IDC_EDIT_X, m_vX);
	DDX_Text(pDX, IDC_STATIC_KQ, m_vKQ);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgLinearEqua, CDialog)
	//{{AFX_MSG_MAP(CDlgLinearEqua)
	ON_BN_CLICKED(IDC_BUTTON_RESULT, OnButtonResult)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgLinearEqua message handlers

void CDlgLinearEqua::OnButtonResult() 
{
	// TODO: Add your control notification handler code here
	double kq;
	int flag = 5;
	char *f;
	
	UpdateData(TRUE);
	double a = strtod(m_vA,&f);
	double b = strtod(m_vB,&f);

	PhuongTrinhBac1(a,b,kq,flag);
	if(flag == 0)
	{
		m_vKQ = "This equation has no root !!!";
		m_vX = "";
	}
	else if (flag == 1)
	{
		m_vKQ = "This equation has a root !!!";
		m_vX.Format("%f",kq);
	}
	else if (flag == 2)
	{
		m_vKQ = "This equation has a countless number of roots !!!";
		m_vX = "";
	}
	
	UpdateData(FALSE);
}

BOOL CDlgLinearEqua::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if (pMsg->message == WM_KEYDOWN)
    {
        if (pMsg->wParam == VK_RETURN){
            pMsg->wParam = NULL;
			OnButtonResult();
		}
    }

	return CDialog::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

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