计 算 机MFC课程设计报告
——模拟计算器
:
学号:02011227
联系:
指导教师:
东南大学机械工程学院
2012年10月14日
模拟计算器
摘要
摘要容:以课本简单计算器为基础,首先实现了加、减、乘、除、求倒数和平方根的混合运算,并能进行清屏及倒退操作,然后自行完善了书中未能实现的乘、除运算的连续操作,最后自行设计并完成了lg、ln 、sin、cos、^、.、pi、e 八个按钮控件的消息映射及程序代码的添加和修改。从中学会了制作简单的基于对话框的小工具、掌握了常用控件的使用、明白了消息映射及消息处理、提高了VC++编程水平。
关键词:四则运算 小数点 计算器
Analog calculator
Abstract
Content of abstract: Simple calculator in textbooks as the foundation, first realized the addition, subtraction, multiplication, division, and reciprocal and square root of the mixed operation, and can clear screen and reverse operation, and then to improve the book failed to realize the multiplication, division operation of continuous operation, and finally to be designed and pleted the eight button control news mapping and program code to add and modify. Learnt how to make simple dialog-based small tools, mastered the use of monly used controls, see news mapping and information processing, improve the level of programming.
Key word: arithmeticDecimal point Calculator
本计算器是基于VC++的MFC编程,可完成大多数简单操作,其运行后界面如下图:
以课本简单计算器为基础,首先实现了加、减、乘、除、求倒数和平方根的混合运算,并能进行清屏及倒退操作,然后自行完善了书中未能实现的乘、除运算的连续操作,最后自行设计并完成了lg、ln 、sin、cos、^、.、pi、e 八个按钮控件的消息映射及程序代码的添加和修改。
完整的操作步骤:
1、创建MFC应用程序框架。使用MFC AppWizard【exe】向导生成一个基于对话框的应用程序 Calculator。
2、编辑对话框。按图添加前21个控件,其中1个为编辑框,20个为按钮,控件ID及Caption设置如下:
IDC_EDIT_PUTOUT IDC_NUMBER1 1
IDC_NUMBER2 2 IDC_NUMBER3 3
IDC_NUMBER4 4
IDC_NUMBER5 5
IDC_NUMBER6 6
IDC_NUMBER7 7
IDC_NUMBER8 8
IDC_NUMBER9 9
IDC_NUMBER0 0
IDC_ADD +
IDC_SUBTRACT -
IDC_MULTIPLY *IDC_DIVIDE /IDC_RESULT =IDC_MINUS +/-
IDC_BACK Back IDC_CLEAR Clear
IDC_SQRT Sqrt
IDC_RECIPROCAL 1/x
IDC_LG lg
IDC_LN ln
IDC_SIN sin
IDC_COS cos
IDC_CHENGFANG ^
IDC_POINT .
IDC_PI pi
IDC_CHAOYUESHU e
添加成员变量。为编辑框在CCalculatorDlg对话框类中添加d
mfc课程设计报告—模拟计算器 来自淘豆网www.taodocs.com转载请标明出处.