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

📄 nqueueview.cpp

📁 用分支界限法实现的n后问题 vc++ 语言效率很好
💻 CPP
字号:
// nqueueView.cpp : implementation of the CNqueueView class
//

#include "stdafx.h"
#include "nqueue.h"

#include "nqueueDoc.h"
#include "nqueueView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CNqueueView

IMPLEMENT_DYNCREATE(CNqueueView, CView)

BEGIN_MESSAGE_MAP(CNqueueView, CView)
	//{{AFX_MSG_MAP(CNqueueView)
	ON_COMMAND(IDC_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()

/////////////////////////////////////////////////////////////////////////////
// CNqueueView construction/destruction

CNqueueView::CNqueueView()
{
	// TODO: add construction code here

}

CNqueueView::~CNqueueView()
{
}

BOOL CNqueueView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CNqueueView drawing

void CNqueueView::OnDraw(CDC* pDC)
{
	CNqueueDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CNqueueView printing

BOOL CNqueueView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CNqueueView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CNqueueView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CNqueueView diagnostics

#ifdef _DEBUG
void CNqueueView::AssertValid() const
{
	CView::AssertValid();
}

void CNqueueView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CNqueueDoc* CNqueueView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CNqueueDoc)));
	return (CNqueueDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CNqueueView message handlers

void CNqueueView::OnGetresult() 
{
	// TODO: Add your command handler code here
  CClientDC dc(this);
  
  CString str;
  inputdig dlg;
  if (dlg.DoModal()==IDOK)
  {
    result res;
	res.setn(dlg.m_n);
	res.GET();
	if(!res.canarrange)
	{
		dc.TextOut(10,40,"没有安排方法");
		
	}
	else
	{
		str.Format("安排方法是:");
		dc.TextOut(10,40,str);
		for(int i=0;i<res.n;i++)
		{
			str.Format("save[%d]=%d",i,res.save[i]);
			dc.TextOut(10,80+40*i,str);
		}
	}
  }
}

⌨️ 快捷键说明

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