Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. where is my fault?

where is my fault?

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goutom roy
    wrote on last edited by
    #1

    ************************************** //#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

    L M D 3 Replies Last reply
    0
    • G goutom roy

      ************************************** //#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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • G goutom roy

        ************************************** //#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

        M Offline
        M Offline
        Michael Schubert
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • G goutom roy

          ************************************** //#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

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          goutom roy wrote:

          ...it run but not give me a error message. plz solve my error.

          Contradiction.

          "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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups