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

📄 kview.cpp

📁 这是一个图书馆管理系统程序
💻 CPP
字号:
// kView.cpp : implementation of the CKView class
//

#include "stdafx.h"
#include "k.h"

#include "kDoc.h"
#include "kView.h"
#include "back2.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CKView

IMPLEMENT_DYNCREATE(CKView, CView)

BEGIN_MESSAGE_MAP(CKView, CView)
	//{{AFX_MSG_MAP(CKView)
	ON_COMMAND(ID_BORROW, OnBorrow)
	ON_COMMAND(ID_BACK, OnBack)
	ON_COMMAND(ID_NEWBOOK, OnNewbook)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CKView construction/destruction

CKView::CKView()
{
	// TODO: add construction code here
how=1000;//是指书号
}

CKView::~CKView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CKView drawing

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

/////////////////////////////////////////////////////////////////////////////
// CKView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CKView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CKView message handlers

void CKView::OnBorrow() 
{
	// TODO: Add your command handler code here
	if(	myborrow.DoModal()==IDOK)
	{
		if(myborrow.m_1==200402&&myborrow.m_2 =="asdf")  //借书所要的证件号和密码
			if(myborrow.m_3<=how)
			{  
				if(mybook[myborrow.m_3 %1000].m_4444>0)  //有书可借
				{
					MessageBox(" 借书成功  ");
					mybook[myborrow.m_3 %1000].m_4444--;//书借完不能再借
				}
				else
					MessageBox("  此书借完  ");
			}
			else
					MessageBox(" 无此书 "); 
		else MessageBox("  输入错误  ");
	}
}                                                     //是指借书的一类的代码添加
void CKView::OnBack() 
{
	// TODO: Add your command handler code here
	Cback myback;
	if(myback.DoModal()==IDOK)
	{
		if(myback.m_22==200402&&myback.m_11<=how&&mybook[how%1000].m_m4>=mybook[how%1000].m_4444)//输入借书证号并且所借书要小于等于本数
		{
			MessageBox(" 此书已还  ");
			mybook[myborrow.m_3 %1000].m_4444++;  //每还同一本书就累加
		}
		else MessageBox("  输入错误  ");
	}
}                                                 //是指还书的一类代码添加
  

void CKView::OnNewbook() 
{
	// TODO: Add your command handler code here
	if(mybook[how%1000].DoModal()==IDOK)          //关于书的定义代码添加	
	{
		how++;
		mybook[how%1000].m_m4=mybook[how%1000].m_4444; //是指原始本数的赋值
	}
}

⌨️ 快捷键说明

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