where is my fault?
-
************************************** //#include "simple calculator.h" ->code class CExerciseApp : public CWinApp { public: virtual BOOL InitInstance(); }; class CMainFrame : public CFrameWnd { //CString s = _T("1032"); //int n = ParseInt( s ); public: CButton b1, b2, b3, b4, b5; CEdit text1, text2, res; CString str1, str2; //CFont font; long a, b, c; CMainFrame(); void addition(); void substruction(); void production(); void dividation(); void modulation(); DECLARE_MESSAGE_MAP() }; ******************************* #include #include #include #include #include "simple calculator.h" #define plus 11 #define minus 12 #define product 13 #define divide 14 #define mod 15 #define textone 500 #define texttwo 600 #define result 700 char str[50]; CMainFrame::CMainFrame() { Create(NULL, L"MENU BUILDING"); text1.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(5,10,120,30), this, textone); text2.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(140,10,255,30), this, texttwo); res.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(275,10,390,30), this, result); text1.GetWindowText(str1); text2.GetWindowText(str2); wsprintf (str,L"%s",str1 ); a=atol(str); wsprintf (str,L"%s",str2 ); b=atol(str); //wsprintf ( a,L"%s",str1); //wsscanf(str1,"%ld",&a); //a=atol(str); //wsprintf ( (LPWSTR)str,L"%c",str2 ); //wsprintf ( b,L"%s",str2 ); //b=atol(str); //wsscanf(str2,"%ld",&b); b1.Create (L"+", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(5,50,30,70), this, plus); b2.Create (L"-", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(45,50,70,70), this, minus); b3.Create (L"*", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(85,50,110,70), this, product); b4.Create (L"/", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(125,50,150,70), this, divide); b5.Create (L"%", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(165,50,190,70), this, mod); //font.CreateFont(20,0,0,0,20,0,0,0, ANSI_CHARSET,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,L"arial"); //sta.SetFont(&font); } BEGIN_MESSAGE_MAP( CMainFrame, CFrameWnd) ON_BN_CLICKED (plus, addition) ON_BN_CLICKED (minus, substr
-
************************************** //#include "simple calculator.h" ->code class CExerciseApp : public CWinApp { public: virtual BOOL InitInstance(); }; class CMainFrame : public CFrameWnd { //CString s = _T("1032"); //int n = ParseInt( s ); public: CButton b1, b2, b3, b4, b5; CEdit text1, text2, res; CString str1, str2; //CFont font; long a, b, c; CMainFrame(); void addition(); void substruction(); void production(); void dividation(); void modulation(); DECLARE_MESSAGE_MAP() }; ******************************* #include #include #include #include #include "simple calculator.h" #define plus 11 #define minus 12 #define product 13 #define divide 14 #define mod 15 #define textone 500 #define texttwo 600 #define result 700 char str[50]; CMainFrame::CMainFrame() { Create(NULL, L"MENU BUILDING"); text1.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(5,10,120,30), this, textone); text2.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(140,10,255,30), this, texttwo); res.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(275,10,390,30), this, result); text1.GetWindowText(str1); text2.GetWindowText(str2); wsprintf (str,L"%s",str1 ); a=atol(str); wsprintf (str,L"%s",str2 ); b=atol(str); //wsprintf ( a,L"%s",str1); //wsscanf(str1,"%ld",&a); //a=atol(str); //wsprintf ( (LPWSTR)str,L"%c",str2 ); //wsprintf ( b,L"%s",str2 ); //b=atol(str); //wsscanf(str2,"%ld",&b); b1.Create (L"+", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(5,50,30,70), this, plus); b2.Create (L"-", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(45,50,70,70), this, minus); b3.Create (L"*", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(85,50,110,70), this, product); b4.Create (L"/", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(125,50,150,70), this, divide); b5.Create (L"%", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(165,50,190,70), this, mod); //font.CreateFont(20,0,0,0,20,0,0,0, ANSI_CHARSET,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,L"arial"); //sta.SetFont(&font); } BEGIN_MESSAGE_MAP( CMainFrame, CFrameWnd) ON_BN_CLICKED (plus, addition) ON_BN_CLICKED (minus, substr
goutom roy wrote:
when i run this code , it run but not give me a error message. plz solve my error.
Are you saying that it runs correctly? If so then there is nothing to fix. However, if you are saying it does give an error message, then please tell us what the message is.
-
************************************** //#include "simple calculator.h" ->code class CExerciseApp : public CWinApp { public: virtual BOOL InitInstance(); }; class CMainFrame : public CFrameWnd { //CString s = _T("1032"); //int n = ParseInt( s ); public: CButton b1, b2, b3, b4, b5; CEdit text1, text2, res; CString str1, str2; //CFont font; long a, b, c; CMainFrame(); void addition(); void substruction(); void production(); void dividation(); void modulation(); DECLARE_MESSAGE_MAP() }; ******************************* #include #include #include #include #include "simple calculator.h" #define plus 11 #define minus 12 #define product 13 #define divide 14 #define mod 15 #define textone 500 #define texttwo 600 #define result 700 char str[50]; CMainFrame::CMainFrame() { Create(NULL, L"MENU BUILDING"); text1.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(5,10,120,30), this, textone); text2.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(140,10,255,30), this, texttwo); res.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(275,10,390,30), this, result); text1.GetWindowText(str1); text2.GetWindowText(str2); wsprintf (str,L"%s",str1 ); a=atol(str); wsprintf (str,L"%s",str2 ); b=atol(str); //wsprintf ( a,L"%s",str1); //wsscanf(str1,"%ld",&a); //a=atol(str); //wsprintf ( (LPWSTR)str,L"%c",str2 ); //wsprintf ( b,L"%s",str2 ); //b=atol(str); //wsscanf(str2,"%ld",&b); b1.Create (L"+", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(5,50,30,70), this, plus); b2.Create (L"-", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(45,50,70,70), this, minus); b3.Create (L"*", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(85,50,110,70), this, product); b4.Create (L"/", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(125,50,150,70), this, divide); b5.Create (L"%", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(165,50,190,70), this, mod); //font.CreateFont(20,0,0,0,20,0,0,0, ANSI_CHARSET,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,L"arial"); //sta.SetFont(&font); } BEGIN_MESSAGE_MAP( CMainFrame, CFrameWnd) ON_BN_CLICKED (plus, addition) ON_BN_CLICKED (minus, substr
goutom roy wrote:
when i run this code , it run but not give me a error message. plz solve my error.
Assuming you mean the opposite of what you wrote - Why don't you just step through the code with the debugger and see where it fails? Also, next time you post your code please embed it in the "code block" tags.
-
************************************** //#include "simple calculator.h" ->code class CExerciseApp : public CWinApp { public: virtual BOOL InitInstance(); }; class CMainFrame : public CFrameWnd { //CString s = _T("1032"); //int n = ParseInt( s ); public: CButton b1, b2, b3, b4, b5; CEdit text1, text2, res; CString str1, str2; //CFont font; long a, b, c; CMainFrame(); void addition(); void substruction(); void production(); void dividation(); void modulation(); DECLARE_MESSAGE_MAP() }; ******************************* #include #include #include #include #include "simple calculator.h" #define plus 11 #define minus 12 #define product 13 #define divide 14 #define mod 15 #define textone 500 #define texttwo 600 #define result 700 char str[50]; CMainFrame::CMainFrame() { Create(NULL, L"MENU BUILDING"); text1.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(5,10,120,30), this, textone); text2.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(140,10,255,30), this, texttwo); res.Create (WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(275,10,390,30), this, result); text1.GetWindowText(str1); text2.GetWindowText(str2); wsprintf (str,L"%s",str1 ); a=atol(str); wsprintf (str,L"%s",str2 ); b=atol(str); //wsprintf ( a,L"%s",str1); //wsscanf(str1,"%ld",&a); //a=atol(str); //wsprintf ( (LPWSTR)str,L"%c",str2 ); //wsprintf ( b,L"%s",str2 ); //b=atol(str); //wsscanf(str2,"%ld",&b); b1.Create (L"+", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(5,50,30,70), this, plus); b2.Create (L"-", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(45,50,70,70), this, minus); b3.Create (L"*", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(85,50,110,70), this, product); b4.Create (L"/", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(125,50,150,70), this, divide); b5.Create (L"%", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, CRect(165,50,190,70), this, mod); //font.CreateFont(20,0,0,0,20,0,0,0, ANSI_CHARSET,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,L"arial"); //sta.SetFont(&font); } BEGIN_MESSAGE_MAP( CMainFrame, CFrameWnd) ON_BN_CLICKED (plus, addition) ON_BN_CLICKED (minus, substr
goutom roy wrote:
...it run but not give me a error message. plz solve my error.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons