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

📄 exam1_1view.cpp

📁 只是一些书籍上的小代码!!!希望站长允许上传
💻 CPP
字号:
// Exam1_1View.cpp : implementation of the CExam1_1View class
//

#include "stdafx.h"
#include "Exam1_1.h"

#include "Exam1_1Doc.h"
#include "Exam1_1View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CExam1_1View

IMPLEMENT_DYNCREATE(CExam1_1View, CView)

BEGIN_MESSAGE_MAP(CExam1_1View, CView)
	//{{AFX_MSG_MAP(CExam1_1View)
	ON_WM_RBUTTONDOWN()
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CExam1_1View construction/destruction

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

}

CExam1_1View::~CExam1_1View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CExam1_1View drawing

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

/////////////////////////////////////////////////////////////////////////////
// CExam1_1View printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CExam1_1View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CExam1_1View message handlers

void CExam1_1View::OnRButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	int num[10];
	int sum=0;
	int average;
	for(int i=0;i<=9;i++)
		num[i]=2*(i+1);
	for(i=0;i<10;i++)
		sum=sum+num[i];
	average=sum/10;
	CString  message;
	message.Format("%d",average);
	MessageBox(message);
	CView::OnRButtonDown(nFlags, point);
}

⌨️ 快捷键说明

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