📄 kchengjiview.cpp
字号:
// kchengjiView.cpp : implementation of the CKchengjiView class
//
#include "stdafx.h"
#include "kchengji.h"
#include "kchengjiDoc.h"
#include "kchengjiView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CKchengjiView
IMPLEMENT_DYNCREATE(CKchengjiView, CView)
BEGIN_MESSAGE_MAP(CKchengjiView, CView)
//{{AFX_MSG_MAP(CKchengjiView)
ON_COMMAND(ID_getresult, Ongetresult)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CKchengjiView construction/destruction
CKchengjiView::CKchengjiView()
{
// TODO: add construction code here
}
CKchengjiView::~CKchengjiView()
{
}
BOOL CKchengjiView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CKchengjiView drawing
void CKchengjiView::OnDraw(CDC* pDC)
{
CKchengjiDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CKchengjiView printing
BOOL CKchengjiView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CKchengjiView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CKchengjiView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CKchengjiView diagnostics
#ifdef _DEBUG
void CKchengjiView::AssertValid() const
{
CView::AssertValid();
}
void CKchengjiView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CKchengjiDoc* CKchengjiView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CKchengjiDoc)));
return (CKchengjiDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CKchengjiView message handlers
void CKchengjiView::Ongetresult()
{
// TODO: Add your command handler code here
int target,length,cutNum;
CString str1,str2;
inputdata dlg;
double x;
if ( dlg.DoModal()==IDOK)
{
target=dlg.m_target;
str1.Format("%d",target);
length=str1.GetLength();//数的位数
}
getresult result;
result.set(target,length);
result.get();
//x=result.traceback(target,num,cutNum);
CClientDC dc(this);
str1.Format("你输入的数是%d",target);
dc.TextOut(40,40,str1);
str2.Format("得到的最大结果是%d",result.max);//必须为%f 为%d则为零;
dc.TextOut(40,80,str2);
str1.Format("划分如下,从下往上");
dc.TextOut(40,120,str1);
int i=result.endposrec;
int t,j=1;
while(result.res[i].parent!=-1)
{ t=result.res[i].parent;
str1.Format(" %d ",result.res[t].endpos );
dc.TextOut(40,120+20*j,str1);
i=result.res[t].parent;
j++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -