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); }
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步