VC++6.0自编程序
源代码在线查看: cout.cpp
// Cout.cpp : implementation file
//
#include "stdafx.h"
#include "WoDeZuoYe.h"
#include "Cout.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCout dialog
CCout::CCout(CWnd* pParent /*=NULL*/)
: CDialog(CCout::IDD, pParent)
{
//{{AFX_DATA_INIT(CCout)
m_edit = _T("");
//}}AFX_DATA_INIT
m_edit="0" ;
m_n=0;
m_second_num=0;
m_first_num=0;
m_flag=1;
point=0 ;
}
void CCout::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCout)
DDX_Text(pDX, IDC_EDIT1, m_edit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCout, CDialog)
//{{AFX_MSG_MAP(CCout)
ON_BN_CLICKED(IDC_BUT1, OnBut1)
ON_BN_CLICKED(IDC_BUT2, OnBut2)
ON_BN_CLICKED(IDC_BUT3, OnBut3)
ON_BN_CLICKED(IDC_BUT4, OnBut4)
ON_BN_CLICKED(IDC_BUT5, OnBut5)
ON_BN_CLICKED(IDC_BUT6, OnBut6)
ON_BN_CLICKED(IDC_BUT7, OnBut7)
ON_BN_CLICKED(IDC_BUT8, OnBut8)
ON_BN_CLICKED(IDC_BUT9, OnBut9)
ON_BN_CLICKED(IDC_BUT10, OnBut10)
ON_BN_CLICKED(IDC_BUTJia, OnBUTJia)
ON_BN_CLICKED(IDC_BUTJian, OnBUTJian)
ON_BN_CLICKED(IDC_BUTCheng, OnBUTCheng)
ON_BN_CLICKED(IDC_BUTChu, OnBUTChu)
ON_BN_CLICKED(IDC_BUTDengYu, OnBUTDengYu)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCout message handlers
void CCout::OnBut1()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_flag==1)
{ m_edit="";
m_flag=0;
}
m_edit= m_edit+"1";
m_num=atof(m_edit);
UpdateData(FALSE);
}
void CCout::OnBut2()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_flag==1)
{ m_edit="";
m_flag=0;
}
m_edit= m_edit+"2";
m_num=atof(m_edit);
UpdateData(FALSE);
}
void CCout::OnBut3()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_flag==1)
{ m_edit="";
m_flag=0;
}
m_edit= m_edit+"3";
m_num=atof(m_edit);
UpdateData(FALSE);
}
void CCout::OnBut4()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_flag==1)
{ m_edit="";
m_flag=0;
}
m_edit= m_edit+"4";
m_num=atof(m_edit);
UpdateData(FALSE);
}
void CCout::OnBut5()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_flag==1)
{ m_edit="";
m_flag=0;
}
m_edit= m_edit+"5";
m_num=atof(m_edit);
UpdateData(FALSE);
}
void CCout::OnBut6()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_flag==1)
{ m_edit="";
m_flag=0;
}
m_edit= m_edit+"6";
m_num=atof(m_edit);
UpdateData(FALSE);
}
void CCout::OnBut7()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_flag==1)
{ m_edit="";
m_flag=0;
}
m_edit= m_edit+"7";
m_num=atof(m_edit);
UpdateData(FALSE);
}
void CCout::OnBut8()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_flag==1)
{ m_edit="";
m_flag=0;
}
m_edit= m_edit+"8";
m_num=atof(m_edit);
UpdateData(FALSE);
}
void CCout::OnBut9()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_flag==1)
{ m_edit="";
m_flag=0;
}
m_edit= m_edit+"9";
m_num=atof(m_edit);
UpdateData(FALSE);
}
void CCout::OnBut10()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_flag==1)
{ m_edit="";
m_flag=0;
}
m_edit= m_edit+"0";
m_num=atof(m_edit);
UpdateData(FALSE);
}
void CCout::OnBUTJia()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_n==0) { m_first_num=atoi(m_edit) ; m_n=1; }
else
{
m_second_num=m_num;
switch( m_operator)
{ case '+' : m_first_num=m_first_num+m_second_num;break ;
case '-' : m_first_num=m_first_num-m_second_num;break ;
case '*' : m_first_num=m_first_num*m_second_num;break ;
case '/' : m_first_num=m_first_num/m_second_num;break ;
default : MessageBox("Error") ; break ;
}
}
m_flag=1;
point=0;
m_operator='+' ;
m_edit.Format("%f",m_first_num);
UpdateData(FALSE);
}
void CCout::OnBUTJian()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_n==0) { m_first_num=atoi(m_edit) ; m_n=1; }
else
{
m_second_num=m_num;
switch( m_operator)
{ case '+' : m_first_num=m_first_num+m_second_num;break ;
case '-' : m_first_num=m_first_num-m_second_num;break ;
case '*' : m_first_num=m_first_num*m_second_num;break ;
case '/' : m_first_num=m_first_num/m_second_num;break ;
default : MessageBox("Error") ; break ;
}
}
m_flag=1;
point=0;
m_operator='-' ;
m_edit.Format("%f",m_first_num);
UpdateData(FALSE);
}
void CCout::OnBUTCheng()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_n==0) { m_first_num=atoi(m_edit) ; m_n=1; }
else
{
m_second_num=m_num;
switch( m_operator)
{ case '+' : m_first_num=m_first_num+m_second_num;break ;
case '-' : m_first_num=m_first_num-m_second_num;break ;
case '*' : m_first_num=m_first_num*m_second_num;break ;
case '/' : m_first_num=m_first_num/m_second_num;break ;
default : MessageBox("Error") ; break ;
}
}
m_flag=1;
point=0;
m_operator='*' ;
m_edit.Format("%f",m_first_num);
UpdateData(FALSE);
}
void CCout::OnBUTChu()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_n==0) { m_first_num=atoi(m_edit) ; m_n=1; }
else
{
m_second_num=m_num;
switch( m_operator)
{ case '+' : m_first_num=m_first_num+m_second_num;break ;
case '-' : m_first_num=m_first_num-m_second_num;break ;
case '*' : m_first_num=m_first_num*m_second_num;break ;
case '/' : m_first_num=m_first_num/m_second_num;break ;
default : MessageBox("Error") ; break ;
}
}
m_flag=1;
point=0;
m_operator='/' ;
m_edit.Format("%f",m_first_num);
UpdateData(FALSE);
}
void CCout::OnBUTDengYu()
{
// TODO: Add your control notification handler code here
UpdateData();
m_second_num=m_num;
switch( m_operator)
{ case '+' : m_edit.Format("%f",m_first_num+m_second_num);break ;
case '-' : m_edit.Format("%f",m_first_num-m_second_num);break ;
case '*' : m_edit.Format("%f",m_first_num*m_second_num);break ;
case '/' : m_edit.Format("%f",m_first_num/m_second_num);break ;
default : MessageBox("Error") ; break ;
}
m_flag=1;
point=0;
m_n=0 ;
m_first_num=atof( m_edit) ;
UpdateData(FALSE);
}
|
相关资源 |
|
-
VC++6.0自编程序
-
本程序利用VC++6.0自带的密码学相关函数库实现数字签名证书的验证
-
本程序利用微软VC++6.0自带的密码学算法库函数
-
VC++6.0实现应用程序软件界面XP风格
-
数据结构算法vc++6.0程序集教材之总览,是一些你编完以后的结果,各部分算法在前面part1-part7部分给出,含线性表,数组,队列,堆栈,广义表,递归,图,排序,以及严蔚明数据结构教材中的各种算
-
一个用VC++6.0编的光学小程序源代码。已知玻璃折射率
-
该词法分析程序用VC++ 6.0编写
-
一个太空大战游戏的源程序及演示程序 VC++ 6.0
|