resource.h
// Student.h: interface for the CStudent class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_STUDENT_H__91A755BB_624D_4216_8D77_681DFC7FBEC3__INCLUDED_)
#define AFX_STUDENT_H__91A755BB_624D_4216_8D77_681DFC7FBEC3__INCLUDED_

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

class CStudent  
{
private:
	CString name;
	int score;
public:
	CStudent();
	CStudent(const CString &n,const int s);
	void display(CDC *,int,int);
	virtual ~CStudent();

};


#endif // !defined(AFX_STUDENT_H__91A755BB_624D_4216_8D77_681DFC7FBEC3__INCLUDED_)

 

student.h

//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by My.rc
//
#define IDD_ABOUTBOX                    100
#define IDR_MAINFRAME                   128
#define IDR_MYTYPE                      129
#define IDD_DIALOG1                     130
#define IDC_EDIT1                       1000
#define IDC_EDIT2                       1002
#define IDC_EDIT3                       1003
#define ID_Menuitem32771                32771

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS                     1
#define _APS_NEXT_RESOURCE_VALUE        132
#define _APS_NEXT_COMMAND_VALUE         32772
#define _APS_NEXT_CONTROL_VALUE         1004
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

 


 

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

#include "stdafx.h"
#include "My.h"
#include "Student.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CStudent::CStudent()
{

}
CStudent::CStudent(const CString &n, int s):name(n),score(s)
	{
	}

CStudent::~CStudent()
{

}
void CStudent::display(CDC *pDC,int x,int y)
{
	CString str;
	str.Format("姓名:%s  成绩:%d",name,score);
	pDC->TextOut(x,y,str);
}