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

📄 mybigassignmentdlg.cpp

📁 学生成绩管理
💻 CPP
字号:
// mybigassignmentDlg.cpp : implementation file
//

#include "stdafx.h"
#include "mybigassignment.h"
#include "mybigassignmentDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMybigassignmentDlg dialog

CMybigassignmentDlg::CMybigassignmentDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CMybigassignmentDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMybigassignmentDlg)
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CMybigassignmentDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMybigassignmentDlg)
	DDX_Control(pDX, IDC_LIST1, m_scroll);
	DDX_Control(pDX, IDC_EDIT16, m_EDIT16);
	DDX_Control(pDX, IDC_EDIT15, m_EDIT15);
	DDX_Control(pDX, IDC_EDIT13, m_EDIT13);
	DDX_Control(pDX, IDC_EDIT14, m_EDIT14);
	DDX_Control(pDX, IDC_EDIT12, m_EDIT12);
	DDX_Control(pDX, IDC_EDIT11, m_EDIT11);
	DDX_Control(pDX, IDC_EDIT10, m_EDIT10);
	DDX_Control(pDX, IDC_EDIT9, m_EDIT9);
	DDX_Control(pDX, IDC_EDIT1, m_EDIT1);
	DDX_Control(pDX, IDC_EDIT8, m_EDIT8);
	DDX_Control(pDX, IDC_EDIT7, m_EDIT7);
	DDX_Control(pDX, IDC_EDIT6, m_EDIT6);
	DDX_Control(pDX, IDC_EDIT5, m_EDIT5);
	DDX_Control(pDX, IDC_EDIT4, m_EDIT4);
	DDX_Control(pDX, IDC_EDIT3, m_EDIT3);
	DDX_Control(pDX, IDC_EDIT2, m_EDIT2);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CMybigassignmentDlg, CDialog)
	//{{AFX_MSG_MAP(CMybigassignmentDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
	ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
	ON_BN_CLICKED(IDC_EXIT, OnExit)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMybigassignmentDlg message handlers

BOOL CMybigassignmentDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CMybigassignmentDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CMybigassignmentDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CMybigassignmentDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CMybigassignmentDlg::OnButton2() 
{
	// TODO: Add your control notification handler code here
	char string1[10],char string2[10],char string3[10],char string4[10],char string5[10],char string6[10];
	double data[8];
	int i;
	m_EDIT4.GetWindowText(string1,10);
	data[1]=atof((LPCTSTR)string1);
	m_EDIT5.GetWindowText(string2,10);
    data[2]=atof((LPCTSTR)string2);
	m_EDIT6.GetWindowText(string3,10);
    data[3]=atof((LPCTSTR)string3);
	m_EDIT7.GetWindowText(string4,10);
    data[4]=atof((LPCTSTR)string4);
	m_EDIT8.GetWindowText(string5,10);
    data[5]=atof((LPCTSTR)string5);
	m_EDIT9.GetWindowText(string6,10);
    data[6]=atof((LPCTSTR)string6);
	data[0]=0;
	for(i=1;i<=6;i++)
    data[0]+=data[i];
	data[7]=data[0]/6;
	char zongfen[10];
	_gcvt(data[0],10,zongfen);
	m_EDIT10.SetSel(0,-1);
	m_EDIT10.ReplaceSel(zongfen);
	UpdateData(FALSE);
}

void CMybigassignmentDlg::OnButton3() 
{
	// TODO: Add your control notification handler code here
		char string1[10],char string2[10],char string3[10],char string4[10],char string5[10],char string6[10];
	double data[8];
	int i;
	m_EDIT4.GetWindowText(string1,10);
	data[1]=atof((LPCTSTR)string1);
	m_EDIT5.GetWindowText(string2,10);
    data[2]=atof((LPCTSTR)string2);
	m_EDIT6.GetWindowText(string3,10);
    data[3]=atof((LPCTSTR)string3);
	m_EDIT7.GetWindowText(string4,10);
    data[4]=atof((LPCTSTR)string4);
	m_EDIT8.GetWindowText(string5,10);
    data[5]=atof((LPCTSTR)string5);
	m_EDIT9.GetWindowText(string6,10);
    data[6]=atof((LPCTSTR)string6);
	data[0]=0;
	for(i=1;i<=6;i++)
    data[0]+=data[i];
	data[7]=data[0]/6;
	char pingjunfen[10];
	_gcvt(data[7],10,pingjunfen);
	UpdateData(FALSE);
	m_EDIT11.SetSel(0,-1);
	m_EDIT11.ReplaceSel(pingjunfen);
	UpdateData(FALSE);
	
}

void CMybigassignmentDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
    char string11[10],char string22[10],char string33[10];
	double Data[4];
	m_EDIT12.GetWindowText(string11,10);
	Data[1]=atof((LPCTSTR)string11);
	m_EDIT13.GetWindowText(string22,10);
    Data[2]=atof((LPCTSTR)string22);
	m_EDIT14.GetWindowText(string33,10);
    Data[3]=atof((LPCTSTR)string33);
	Data[0]=Data[1]+Data[2]*2+Data[3]*3;
	char defen[10];
	_gcvt(Data[0],10,defen);
	m_EDIT15.SetSel(0,-1);
	m_EDIT15.ReplaceSel(defen);
	UpdateData(FALSE);
	
}

void CMybigassignmentDlg::OnButton4() 
{
	// TODO: Add your control notification handler code here
    char string1[10],char string2[10],char string3[10],char string4[10],char string5[10],char string6[10];
	double data[8];
	int i;
	m_EDIT4.GetWindowText(string1,10);
	data[1]=atof((LPCTSTR)string1);
	m_EDIT5.GetWindowText(string2,10);
    data[2]=atof((LPCTSTR)string2);
	m_EDIT6.GetWindowText(string3,10);
    data[3]=atof((LPCTSTR)string3);
	m_EDIT7.GetWindowText(string4,10);
    data[4]=atof((LPCTSTR)string4);
	m_EDIT8.GetWindowText(string5,10);
    data[5]=atof((LPCTSTR)string5);
	m_EDIT9.GetWindowText(string6,10);
    data[6]=atof((LPCTSTR)string6);
	data[0]=0;
	for(i=1;i<=6;i++)
    data[0]+=data[i];
	data[7]=data[0]/6;
	UpdateData(FALSE);

	char string11[10],char string22[10],char string33[10];
	double Data[4];
    double data1;
	char zonghepingfen[10];
	m_EDIT12.GetWindowText(string11,10);
	Data[1]=atof((LPCTSTR)string11);
	m_EDIT13.GetWindowText(string22,10);
    Data[2]=atof((LPCTSTR)string22);
	m_EDIT14.GetWindowText(string33,10);
    Data[3]=atof((LPCTSTR)string33);
	Data[0]=Data[1]+Data[2]*2+Data[3]*3;
    data1=Data[0]+data[7];
	_gcvt(data1,10,zonghepingfen);
	m_EDIT16.SetSel(0,-1);
	m_EDIT16.ReplaceSel(zonghepingfen);
	UpdateData(FALSE);
}

void CMybigassignmentDlg::OnButton5() 
{
	// TODO: Add your control notification handler code here
	char str1[25],str2[25],str3[25],str4[25];
   m_EDIT1.GetWindowText(str1,10);
   m_EDIT16.GetWindowText(str2,10);
   m_EDIT2.GetWindowText(str3,10);
   m_EDIT3.GetWindowText(str4,10);
   strcat(str2,str1);
   strcat(str2,str3);
   strcat(str2,str4);
   m_scroll.AddString(str2);
}

void CMybigassignmentDlg::OnExit() 
{
	// TODO: Add your control notification handler code here
	OnOK();
	
}

⌨️ 快捷键说明

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