========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : XYCALC
========================================================================
计算器程序说明如下:
部分类的说明如下:
CAboutDlg: 关于对话框类
CColorButton:彩色按钮类
CMFECTToolTip:按钮的提示类
CCountDlg: 统计对话框类
CXYCALCDlg:标准型对话框类
CKXdlg:科学型对话框
一.对于标准型对话框:
在计算时不考虑算符优先级:可以这样处理:
定义:bool m_operavail
值为0时,输入数据,取得数据后,其值为1。
当按下运算符时,若该值为1,则计算结果,然后,将其置0。
1. 对于0~9 10个数字,共用OnClickedNumber( ) 函数。
2. 每次输入完数据后,调用updatedisp() 函数显示。
3. 按下运算符按钮后,调用perform()函数,并记下此次的运算符。每次计算刚刚输入的两个数据,不考虑优先级。运算符定义为枚举类型。
4. 设置double memoryvalue,用来存储数据于存储区。
二.对于科学型对话框:
在设计时,考虑到优先级,采用类似与堆栈的操作。
同时,由于有A.双字,字,字节三种字长,以及B.十进制,二进制,八进制,十六进制四种进制,所以,在输入,输出,计算,以及各种进制转换时都要考虑上述A,B两种情况。
1.将输入的各种进制数据转化为十进制存储,计算后,再次转化为各种进制输出。
2.输入数据时,调用clicknumber()函数,和input( )函数用来限制数据的范围。对于A~F,共用ClickNumberAF( )函数。
3.分别编写函数:enable10( ),enable2( ), enable8( ), enable16( )来控制对话框中按钮的可用性。Enablefunc( )用来控制部分函数按钮的可用性, enablecount( )用来控制统计功能按钮的可用性。
4.分别编写函数:disp16(),disp2(),disp8()用来显示各种进制的数据和结果。
5. 每次按下运算符按钮后,记下该运算符,并调用pushfh()函数。若该运算符优先级大于栈顶运算符,则压入,否则,计算完结果后,再压入。其间,考虑到括号,对其进行类似处理。
6. 对于其他运算函数,作同样处理。
7. 另外,用到统计函数,设置非模式对话框CCountDlg。设置extern CCountDlg* g_pmodless 与科学型对话框传递数据。
8. 对于菜单中的复制,粘贴,用static Cstring fuzhi 变量进行数据传递。
9. 对于按钮的颜色,用到CcolorButton类,对于按钮提示,用到CMFECTToolTip类。
三.帮助文件。
//使用HelPWorkshop 来制作。
AppWizard has created this XYCALC application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your XYCALC application.
XYCALC.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
XYCALC.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CXYCALCApp application class.
XYCALC.cpp
This is the main application source file that contains the application
class CXYCALCApp.
XYCALC.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Visual C++.
XYCALC.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
res\XYCALC.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file XYCALC.rc.
res\XYCALC.rc2
This file contains resources that are not edited by Microsoft
Visual C++. You should place all resources not editable by
the resource editor in this file.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one dialog class:
XYCALCDlg.h, XYCALCDlg.cpp - the dialog
These files contain your CXYCALCDlg class. This class defines
the behavior of your application's main dialog. The dialog's
template is in XYCALC.rc, which can be edited in Microsoft
Visual C++.
/////////////////////////////////////////////////////////////////////////////
Help Support:
hlp\XYCALC.hpj
This file is the Help Project file used by the Help compiler to create
your application's Help file.
hlp\*.bmp
These are bitmap files required by the standard Help file topics for
Microsoft Foundation Class Library standard commands.
hlp\*.rtf
This file contains the standard help topics for standard MFC
commands and screen objects.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named XYCALC.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Visual C++ reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFC42XXX.DLL
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFC42DEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////
VC6.0编写的模仿Windows计算器的程序
5星 · 超过95%的资源 需积分: 10 110 浏览量
2009-04-02
16:29:49
上传
评论
收藏 123KB ZIP 举报
htx99
- 粉丝: 9
- 资源: 42
最新资源
- Screenshot_20240427_031602.jpg
- 网页PDF_2024年04月26日 23-46-14_QQ浏览器网页保存_QQ浏览器转格式(6).docx
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
- 课设-内部排序算法比较 包括冒泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、归并排序和堆排序.zip
- Python排序算法.zip
- C语言实现直接插入排序、希尔排序、选择排序、冒泡排序、堆排序、快速排序、归并排序、计数排序,并带图详解.zip
- 常用工具集参考用于图像等数据处理
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈