📄 testdoc.cpp
字号:
// TestDoc.cpp : implementation of the CTestDoc class
//
#include "stdafx.h"
#include "Test.h"
#include "TestDoc.h"
#include "matlib.h"
#include "main.h"
#include "fun.h"
#include "AnswerDlg.h"
#include "InputDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestDoc
IMPLEMENT_DYNCREATE(CTestDoc, CDocument)
BEGIN_MESSAGE_MAP(CTestDoc, CDocument)
//{{AFX_MSG_MAP(CTestDoc)
ON_COMMAND(ID_START_Test, OnSTARTTest)
ON_COMMAND(ID_START_ANSWER, OnStartAnswer)
ON_COMMAND(ID_START_INPUT, OnStartInput)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestDoc construction/destruction
CTestDoc::CTestDoc()
{
// TODO: add one-time construction code here
x=0.0;
y=0.0;
Answer=0.0;
}
CTestDoc::~CTestDoc()
{
}
BOOL CTestDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CTestDoc serialization
void CTestDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CTestDoc diagnostics
#ifdef _DEBUG
void CTestDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CTestDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTestDoc commands
void CTestDoc::OnSTARTTest()
{
// TODO: Add your command handler code here
begin_scope
initM(MATCOM_VERSION);
dMm(A);
//dMm(x1); dMm(x2);
//x1.r(1)=x;
//x2.r(1)=y;
double x1,x2;
x1=x;
x2=y;
call_stack_begin;
A = fun(x1,x2);
call_stack_end;
Answer=A.r(1);
exitM();
end_scope
}
void CTestDoc::OnStartAnswer()
{
// TODO: Add your command handler code here
CAnswerDlg dlg;
dlg.m_answer=Answer;
if (dlg.DoModal()==IDOK)
{
Answer=dlg.m_answer;
}
}
void CTestDoc::OnStartInput()
{
// TODO: Add your command handler code here
CInputDlg dlg;
dlg.m_x=x;
dlg.m_y=y;
if (dlg.DoModal()==IDOK)
{
x=dlg.m_x;
y=dlg.m_y;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -