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

📄 exam6_1doc.cpp

📁 This is Visual C++ basis operation. Using that you can fast go in study.
💻 CPP
字号:
// Exam6_1Doc.cpp : implementation of the CExam6_1Doc class
//

#include "stdafx.h"
#include "Exam6_1.h"

#include "Exam6_1Doc.h"
#include "ScoreDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CExam6_1Doc

IMPLEMENT_DYNCREATE(CExam6_1Doc, CDocument)

BEGIN_MESSAGE_MAP(CExam6_1Doc, CDocument)
	//{{AFX_MSG_MAP(CExam6_1Doc)
	ON_COMMAND(ID_SCOREFILLING, OnScorefilling)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CExam6_1Doc construction/destruction

CExam6_1Doc::CExam6_1Doc()
{
	// TODO: add one-time construction code here
	TScore=0;
	for(int i=0;i<5;i++)
		score[i]=0;

}

CExam6_1Doc::~CExam6_1Doc()
{
}

BOOL CExam6_1Doc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CExam6_1Doc serialization

void CExam6_1Doc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CExam6_1Doc diagnostics

#ifdef _DEBUG
void CExam6_1Doc::AssertValid() const
{
	CDocument::AssertValid();
}

void CExam6_1Doc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CExam6_1Doc commands

void CExam6_1Doc::OnScorefilling() 
{
	// TODO: Add your command handler code here
	CScoreDlg dlg; //创建对话框对象	
    dlg.m_score1=score[0]; //初始化对话框数据成员
	dlg.m_score2=score[1];
	dlg.m_score3=score[2];
	dlg.m_score4=score[3];
	dlg.m_score5=score[4];

	if(dlg.DoModal()==IDOK )//调用对话框并判断返回值为IDOK
	{ 
		//使用对话框对象的成员变量的值修改文档对象的成员变量
    	score[0]=dlg.m_score1 ;  	  
    	score[1]=dlg.m_score2 ;      
		score[2]=dlg.m_score3 ;	  
		score[3]=dlg.m_score4 ;	  
		score[4]=dlg.m_score5 ;	  
		for(int i=0;i<5;i++)   //计算总分	  
			TScore+=score[i];	  
		this->UpdateAllViews(NULL); //更新视图	
	}
	
}

⌨️ 快捷键说明

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