CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C/C++ >  C语言

本人刚刚学习C++,弄了一个工资管理的源程序,希望高手赐教。

楼主luyingb(每天进步一点点)2003-06-02 08:58:12 在 C/C++ / C语言 提问

如题,我把源程序的一部分帖出来,希望高手能帮忙把注释部分以及重要的地方给解释一下,不胜感激。  
  ---record.h----------------  
   
  #if   !defined(AFX_RECORD_H__7D6420A9_79B0_4733_85F0_AC9015BA3239__INCLUDED_)  
  #define   AFX_RECORD_H__7D6420A9_79B0_4733_85F0_AC9015BA3239__INCLUDED_  
   
  #if   _MSC_VER   >   1000  
  #pragma   once  
  #endif   //   _MSC_VER   >   1000  
  //   Record.h   :   header   file  
  //  
   
  /////////////////////////////////////////////////////////////////////////////  
  //   CRecord   dialog  
   
  class   CRecord   :   public   CDialog  
  {  
  //   Construction  
  public:  
  CRecord(CWnd*   pParent   =   NULL);       //   standard   constructor  
          BOOL   m_flags;  
  void   UpdateChange();  
  //   Dialog   Data  
  //{{AFX_DATA(CRecord)  
  enum   {   IDD   =   IDD_RECODE   };  
  CEdit m_wname;  
  CButton m_action;  
  int m_age;  
  double m_alldays;  
  double m_allmoney;  
  double m_effectdays;  
  double m_expanddays;  
  double m_extramoney;  
  double m_fakedays;  
  COleDateTime m_firstdate;  
  double m_leftdays;  
  CString m_name;  
  CString m_phone;  
  long m_treat;  
  int m_sex;  
  CString m_work;  
  long m_number;  
  //}}AFX_DATA  
   
   
  //   Overrides  
  //   ClassWizard   generated   virtual   function   overrides  
  //{{AFX_VIRTUAL(CRecord)  
  protected:  
  virtual   void   DoDataExchange(CDataExchange*   pDX);         //   DDX/DDV   support  
  //}}AFX_VIRTUAL  
   
  //   Implementation  
  protected:  
   
  //   Generated   message   map   functions  
  //{{AFX_MSG(CRecord)  
  afx_msg   void   OnAction();  
  virtual   BOOL   OnInitDialog();  
  afx_msg   void   OnChangeTreat();  
  afx_msg   void   OnChangeFirstdate();  
  afx_msg   void   OnChangeFakedays();  
  afx_msg   void   OnChangeExtramoney();  
  afx_msg   void   OnChangeExpanddays();  
  //}}AFX_MSG  
  DECLARE_MESSAGE_MAP()  
  };  
   
  //{{AFX_INSERT_LOCATION}}  
  //   Microsoft   Visual   C++   will   insert   additional   declarations   immediately   before   the   previous   line.  
   
  #endif   //   !defined(AFX_RECORD_H__7D6420A9_79B0_4733_85F0_AC9015BA3239__INCLUDED_)  
   
  ------record.cpp-------------------  
  //   Record.cpp   :   implementation   file  
  //  
   
  #include   "stdafx.h"  
  #include   "Laborage.h"  
  #include   "Record.h"  
   
  #ifdef   _DEBUG  
  #define   new   DEBUG_NEW  
  #undef   THIS_FILE  
  static   char   THIS_FILE[]   =   __FILE__;  
  #endif  
   
  /////////////////////////////////////////////////////////////////////////////  
  //   CRecord   dialog  
   
   
  CRecord::CRecord(CWnd*   pParent   /*=NULL*/)  
  :   CDialog(CRecord::IDD,   pParent)  
  {  
  //{{AFX_DATA_INIT(CRecord)  
  m_age   =   0;  
  m_alldays   =   0.0;  
  m_allmoney   =   0.0;  
  m_effectdays   =   0.0;  
  m_expanddays   =   0.0;  
  m_extramoney   =   0.0;  
  m_fakedays   =   0.0;  
  m_firstdate   =   COleDateTime::GetCurrentTime();  
  m_leftdays   =   0.0;  
  m_name   =   _T("");  
  m_phone   =   _T("");  
  m_treat   =   0;  
  m_sex   =   0;  
  m_work   =   _T("");  
  m_number   =   0;  
  //}}AFX_DATA_INIT  
  m_flags=0;  
  }  
   
   
  void   CRecord::DoDataExchange(CDataExchange*   pDX)  
  {  
  CDialog::DoDataExchange(pDX);  
  //{{AFX_DATA_MAP(CRecord)  
  DDX_Control(pDX,   IDC_NAME,   m_wname);  
  DDX_Control(pDX,   IDC_ACTION,   m_action);  
  DDX_Text(pDX,   IDC_AGE,   m_age);  
  DDV_MinMaxInt(pDX,   m_age,   0,   999);  
  DDX_Text(pDX,   IDC_ALLDAYS,   m_alldays);  
  DDX_Text(pDX,   IDC_ALLMONEY,   m_allmoney);  
  DDX_Text(pDX,   IDC_EFFECTDAYS,   m_effectdays);  
  DDX_Text(pDX,   IDC_EXPANDDAYS,   m_expanddays);  
  DDV_MinMaxDouble(pDX,   m_expanddays,   0.,   10000.);  
  DDX_Text(pDX,   IDC_EXTRAMONEY,   m_extramoney);  
  DDX_Text(pDX,   IDC_FAKEDAYS,   m_fakedays);  
  DDV_MinMaxDouble(pDX,   m_fakedays,   0.,   10000.);  
  DDX_Text(pDX,   IDC_FIRSTDATE,   m_firstdate);  
  DDX_Text(pDX,   IDC_LEFTDAYS,   m_leftdays);  
  DDX_Text(pDX,   IDC_NAME,   m_name);  
  DDV_MaxChars(pDX,   m_name,   64);  
  DDX_Text(pDX,   IDC_PHONE,   m_phone);  
  DDV_MaxChars(pDX,   m_phone,   32);  
  DDX_Text(pDX,   IDC_TREAT,   m_treat);  
  DDV_MinMaxLong(pDX,   m_treat,   0,   10000);  
  DDX_CBIndex(pDX,   IDC_SEX,   m_sex);  
  DDX_Text(pDX,   IDC_WORK,   m_work);  
  DDV_MaxChars(pDX,   m_work,   64);  
  DDX_Text(pDX,   IDC_NUMBER,   m_number);  
  DDV_MinMaxLong(pDX,   m_number,   0,   1000000);  
  //}}AFX_DATA_MAP  
  }  
   
   
  BEGIN_MESSAGE_MAP(CRecord,   CDialog)  
  //{{AFX_MSG_MAP(CRecord)  
  ON_BN_CLICKED(IDC_ACTION,   OnAction)  
  ON_EN_CHANGE(IDC_TREAT,   OnChangeTreat)  
  ON_EN_CHANGE(IDC_FIRSTDATE,   OnChangeFirstdate)  
  ON_EN_CHANGE(IDC_FAKEDAYS,   OnChangeFakedays)  
  ON_EN_CHANGE(IDC_EXTRAMONEY,   OnChangeExtramoney)  
  ON_EN_CHANGE(IDC_EXPANDDAYS,   OnChangeExpanddays)  
  //}}AFX_MSG_MAP  
  END_MESSAGE_MAP()  
   
  /////////////////////////////////////////////////////////////////////////////  
  //   CRecord   message   handlers  
   
   
  BOOL   CRecord::OnInitDialog()    
  {  
  CDialog::OnInitDialog();  
   
  //   TODO:   Add   extra   initialization   here  
  if(m_flags)  
  {  
  this->m_action.SetWindowText("修改");  
  this->SetWindowText("修改记录");  
  m_wname.SetReadOnly();  
  }  
  else  
  {  
                  this->m_action.SetWindowText("新增");  
  this->SetWindowText("新增记录");  
  }  
   
  return   TRUE;     //   return   TRUE   unless   you   set   the   focus   to   a   control  
                              //   EXCEPTION:   OCX   Property   Pages   should   return   FALSE  
  }  
   
  void   CRecord::UpdateChange()  
  {  
        UpdateData();  
        CTime   time=CTime::GetCurrentTime();  
        int   total=(time.GetYear()-m_firstdate.GetYear())*366+(time.GetMonth()-m_firstdate.GetMonth())*31+time.GetDay()-m_firstdate.GetDay();  
        m_alldays=total;  
        m_effectdays=total-m_fakedays;  
        m_leftdays=m_effectdays-m_expanddays;  
        m_allmoney=m_leftdays*m_treat+m_extramoney;  
        UpdateData(FALSE);  
  }  
   
  void   CRecord::OnChangeTreat()    
  {  
  //   TODO:   If   this   is   a   RICHEDIT   control,   the   control   will   not  
  //   send   this   notification   unless   you   override   the   CDialog::OnInitDialog()  
  //   function   and   call   CRichEditCtrl().SetEventMask()  
  //   with   the   ENM_CHANGE   flag   ORed   into   the   mask.  
  UpdateChange();  
  //   TODO:   Add   your   control   notification   handler   code   here  
   
  }  
   
  void   CRecord::OnChangeFirstdate()    
  {  
  //   TODO:   If   this   is   a   RICHEDIT   control,   the   control   will   not  
  //   send   this   notification   unless   you   override   the   CDialog::OnInitDialog()  
  //   function   and   call   CRichEditCtrl().SetEventMask()  
  //   with   the   ENM_CHANGE   flag   ORed   into   the   mask.  
  UpdateChange();  
  //   TODO:   Add   your   control   notification   handler   code   here  
   
  }  
   
  void   CRecord::OnChangeFakedays()    
  {  
  //   TODO:   If   this   is   a   RICHEDIT   control,   the   control   will   not  
  //   send   this   notification   unless   you   override   the   CDialog::OnInitDialog()  
  //   function   and   call   CRichEditCtrl().SetEventMask()  
  //   with   the   ENM_CHANGE   flag   ORed   into   the   mask.  
  UpdateChange();  
  //   TODO:   Add   your   control   notification   handler   code   here  
   
  }  
   
  void   CRecord::OnChangeExtramoney()    
  {  
  //   TODO:   If   this   is   a   RICHEDIT   control,   the   control   will   not  
  //   send   this   notification   unless   you   override   the   CDialog::OnInitDialog()  
  //   function   and   call   CRichEditCtrl().SetEventMask()  
  //   with   the   ENM_CHANGE   flag   ORed   into   the   mask.  
  UpdateChange();  
  //   TODO:   Add   your   control   notification   handler   code   here  
   
  }  
   
  void   CRecord::OnChangeExpanddays()    
  {  
  //   TODO:   If   this   is   a   RICHEDIT   control,   the   control   will   not  
  //   send   this   notification   unless   you   override   the   CDialog::OnInitDialog()  
  //   function   and   call   CRichEditCtrl().SetEventMask()  
  //   with   the   ENM_CHANGE   flag   ORed   into   the   mask.  
  UpdateChange();  
  //   TODO:   Add   your   control   notification   handler   code   here  
   
  }  
   
  void   CRecord::OnAction()    
  {  
  //   TODO:   Add   your   control   notification   handler   code   here  
  UpdateData();  
  if(this->m_name=="")    
  {  
  MessageBox("您还没有填写姓名!");  
  return;  
  }  
  if(this->m_treat==0)  
  {  
                  MessageBox("待遇不能为零!");  
  return;  
  }  
          if(this->m_age<=0)    
  {  
                  MessageBox("年龄必需大于零!");  
  return;  
  }  
  this->OnOK();  
  }  
   
  问题点数:0、回复次数:0Top

相关问题

  • c源程序。
  • 哪儿有 C++源程序
  • 谁有C++的源程序
  • 刚学C#,求源程序!
  • 哪里有turbo C的源程序??
  • 什么地方有C#源程序下?
  • 100分!哪位有“工资管理系统”的源程序或者是开发文档?可否给我一份?学习用!
  • 请问如何在C++BUIDER4.0上编译C++的源程序?
  • 想找lzw算法的源程序(c/c++)
  • 一个简单问题 c/c++ ,附源程序

关键词

  • idc
  • pdx
  • crecord
  • ddx
  • doublem
  • expanddays
  • fakedays
  • afx
  • effectdays
  • extramoney

得分解答快速导航

  • 帖主:luyingb

相关链接

  • C/C++ Blog
  • C/C++类图书
  • C/C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo