i want that a person input the year he/she was born
that is inputted into an edit box called IDC_year with a member variable of double m_Year
the current year is located on top with a group box called IDC_CURRENT_AGE with a member variable of CButton m_Current_Age
I added a private called m_Your_Age
I initialized it with m_Your_Age = 2001;
I initialized m_Year with NULL
now i want that when the person hit submit the year that was put in m_Year to be subtracted from m_Current_Age
void CAgeDlg::OnCancel()
{
// TODO: Add your control notification handler code here
CString s;
s.Format("You are %.0f years old",m_Your_Age);
MessageBox(s, "Your age is...");
CDialog::OnCancel();
}
void CAgeDlg::CalculateAge()
{
if (m_Year < 2001)
{
(m_Your_Age -= m_Year);
}
}
void CAgeDlg::OnSubmit()
{
// 1.
(m_Your_Age -= m_Year);
// 2.
CalculateAge();
// 3.
CString s;
s.Format("You are %.0f years old", m_Your_Age);
m_Current_Age.SetWindowText(s);
}