添加学生类

// Student1.h: interface for the CStudent class.
//
//

#if !defined(AFX_STUDENT1_H__6C489F85_8EF3_473A_BD60_004F7B036622__INCLUDED_)
#define AFX_STUDENT1_H__6C489F85_8EF3_473A_BD60_004F7B036622__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CStudent  
{
public:
	CStudent();
	CStudent(const CString &name,int english);
	void Display(CDC*,int,int);
	virtual ~CStudent();
private:
	CString name;
	int english;

};

#endif // !defined(AFX_STUDENT1_H__6C489F85_8EF3_473A_BD60_004F7B036622__INCLUDED_)



// Student1.cpp: implementation of the CStudent class.
//
//

#include "stdafx.h"
#include "student.h"
#include "Student1.h"

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

//
// Construction/Destruction
//

CStudent::CStudent(const CString &name,int english):name(name),english(english)
{
	
}
void CStudent::Display(CDC *pDC,int x,int y)
{
	CString str;
	str.Format("姓名:%s,英语成绩:%d",name,english);
	pDC->TextOut(x,y,str);
}

CStudent::~CStudent()
{

}



// studentView.cpp : implementation of the CStudentView class
//

#include "stdafx.h"
#include "student.h"

#include "studentDoc.h"
#include "studentView.h"
#include "Student1.h"

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

/
// CStudentView

IMPLEMENT_DYNCREATE(CStudentView, CView)

BEGIN_MESSAGE_MAP(CStudentView, CView)
	//{{AFX_MSG_MAP(CStudentView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}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()

/
// CStudentView construction/destruction

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

}

CStudentView::~CStudentView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/
// CStudentView drawing

void CStudentView::OnDraw(CDC* pDC)
{
	CStudentDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	CStudent st1("小丽",90);
	st1.Display(pDC,20,20);
}

/
// CStudentView printing

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

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

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

/
// CStudentView diagnostics

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

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

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

/
// CStudentView message handlers

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值