计算器设计报告 简易计算器的设计报告

上传人:我*** 文档编号:121961407 上传时间:2020-02-28 格式:DOCX 页数:13 大小:18.93KB
返回 下载 相关 举报
计算器设计报告 简易计算器的设计报告_第1页
第1页 / 共13页
计算器设计报告 简易计算器的设计报告_第2页
第2页 / 共13页
计算器设计报告 简易计算器的设计报告_第3页
第3页 / 共13页
计算器设计报告 简易计算器的设计报告_第4页
第4页 / 共13页
计算器设计报告 简易计算器的设计报告_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《计算器设计报告 简易计算器的设计报告》由会员分享,可在线阅读,更多相关《计算器设计报告 简易计算器的设计报告(13页珍藏版)》请在金锄头文库上搜索。

1、计算器设计报告 简易计算器的设计报告计算器的设计1概述课程设计目的1、巩固并加深学生对C+语言程序设计知识的理解;2、培养学生面向对象的程序设计思想,使学生认识面向过程和面向对象两种设计方法的区别;3、进一步掌握和应用VC+ 集成开发环境;4、提高运用C+语言解决实际问题的能力;5、初步掌握开发小型实用软件的基本方法,能独立设计、实现基本的MIS系统;6、掌握书写程序设计开发文档的能力(书写课程设计实验报告)。课程设计内容课题名称:计算器的实现说明:实现一个计算器。要求:用“计算器”的标准视图执行简单的计算。3四则代码如下void CCALDlg:OnButtonequal/ TODO: Ad

2、d your control notification handler code hereUpdateData(TRUE);num2 =m_str;if(num2=0&ope=3)m_str1=除数不能为零;m_str =0;num1 = 0;num2 = 0;UpdateData(FALSE);else/ int f = 0;switch (ope)/加case 0:m_str = num1 + num2;peak;/减case 1:m_str = num1 - num2;peak;54系统详细设计设计步骤打开Microsoft Visual C+ ,在文件中点击新建,在弹出框内选择MFC

3、AppWizardexe工程,输入工程名yeyahui及其所在位置,点击确定,如图4-1所示。图4-1 新建MFC AppWizardexe工程将弹出MFC AppWizard-step 1对话框,选择基本对话框,点击完成,如图4-2所示。7图4-3新建的对话框界面设计界面设计主要是创建控件,在图4-3所示的ResoureView选项卡中打开Dialog资源组,双击IDD_ZHOUTONG_DIALOG,在右边的窗口中显示出待xx的对话框。开始摆放控件,包括xx框和按钮的创建。按钮的创建以“1”为例进行介绍,其他按钮的创建可参照此进行操作。1)在图4-3中Controls的“xx框”按钮上单击

4、鼠标左键,在对话框xx窗口上合适的位置按下鼠标左键并拖动鼠标画出一个大小合适的xx框。在xx框上单击鼠标右键,在弹出的快捷莱单中选择属性选项,此时弹出Edit属性对话框,如图4-4所示,在该对话框中输入ID属性。9图5-1 四则运算,乘法测试结果图13附 录附录1 源程序清单/ 计算器 : implementation file/#include #include #include #ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CAboutDlg dialog u

5、sed for App Aboutclass CAboutDlg : public CDialogpublic: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/ Imp

6、lementationprotected:/AFX_MSG(CAboutDlg)/AFX_MSGDECLARE_MESSAGE_MAP;CAboutDlg:CAboutDlg : CDialog(CAboutDlg:IDD)/AFX_DATA_INIT(CAboutDlg)/AFX_DATA_INITvoid CAboutDlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CAboutDlg)/AFX_DATA_MAP15/ CCALDlg message handlersBOOL CC

7、ALDlg:OnInitDialogCDialog: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_ABOUTBOXCMenu* pSysMenu = GetSystemMenu(FALSE);if (pSysMenu != NULL)CString strAboutMenu;(IDS_ABOUTBOX);if (! )pSy

8、sMenu-AppendMenu(MF_SEPARATOR);pSysMenu-AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);/ Set the icon for this dialog. The framework does this automatically/ when the applications main window is not a dialogSetIcon(m_hIcon, TRUE);/ Set big iconSetIcon(m_hIcon, FALSE);/ Set small iconSetWindowText

9、(_T(计算器 13级数学与计算机学院第4期 陈菁);/修改软件名称/ TODO: Add extra initialization herereturn TRUE; / return TRUE unless you set the focus to a controlvoid CCALDlg:OnSysCommand(UINT nID, LPARAM lParam)if (nID & 0xFFF0) = IDM_ABOUTBOX)CAboutDlg dlgAbout;elseCDialog:OnSysCommand(nID, lParam);/ If you add a minimize b

10、utton 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 CCALDlg:OnPaintif (IsIconic )CPaintDC dc(this); / device context for painting17void CCALDlg:OnButton3/ TODO: Add your co

11、ntrol notification handler code hereUpdateData(TRUE);m_str =0;m_str=m_str+3;UpdateData(FALSE);void CCALDlg:OnButton4/ TODO: Add your control notification handler code hereUpdateData(TRUE);m_str =0;m_str=m_str+4;UpdateData(FALSE);void CCALDlg:OnButton5/ TODO: Add your control notification handler cod

12、e hereUpdateData(TRUE);m_str =0;m_str=m_str+5;UpdateData(FALSE);void CCALDlg:OnButton6/ TODO: Add your control notification handler code hereUpdateData(TRUE);m_str =0;m_str=m_str+6;UpdateData(FALSE);void CCALDlg:OnButton7/ TODO: Add your control notification handler code hereUpdateData(TRUE);m_str =

13、0;m_str=m_str+7;UpdateData(FALSE);void CCALDlg:OnButton8/ TODO: Add your control notification handler code hereUpdateData(TRUE);m_str =0;19else/ int f = 0;switch (ope)/加case 0:m_str = num1 + num2;peak;/减case 1:m_str = num1 - num2;peak;case 2:m_str = num1 * num2;peak;case 3:m_str = num1 / num2;peak;case 4:m_str = num1 * nu

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 工作范文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号