How to Comine two numbers, not addition.
-
Please help me. i am a MFC beginner , and i don't know how to combine two numbers in a dialog box. for example: when a and b are entered into Box1 and Box2, In Box3 will show "ab", NOT "a+b" . Please........HELP.
using CString + operator Eg. CString str = atoi(YourInteger); str += "2"; Sonork 100.41263:Anthony_Yio
-
Please help me. i am a MFC beginner , and i don't know how to combine two numbers in a dialog box. for example: when a and b are entered into Box1 and Box2, In Box3 will show "ab", NOT "a+b" . Please........HELP.
hey, guy, try this... :) ... char szA[100], szB[100], szC[200]; int c; printf(szA,"%d",a); //here, a is a int number entered on edit box 1. printf(szB,"%d",b); //here, b is a int number entered on edit box 2. strcpy(szC,szA); strcat(szC,szB); c = atoi(szC); //here, c is the int number you want, just place it into edit box 3 ... hope this helps! ;)
-
hey, guy, try this... :) ... char szA[100], szB[100], szC[200]; int c; printf(szA,"%d",a); //here, a is a int number entered on edit box 1. printf(szB,"%d",b); //here, b is a int number entered on edit box 2. strcpy(szC,szA); strcat(szC,szB); c = atoi(szC); //here, c is the int number you want, just place it into edit box 3 ... hope this helps! ;)
char szA[100], szB[100], szC[200]; int c; printf(szA,"%d",a); //here, a is a int number entered on edit box 1. printf(szB,"%d",b); //here, b is a int number entered on edit box 2. strcpy(szC,szA); strcat(szC,szB); c = atoi(szC); //here, c is the int number you want, just place it into edit box 3 This doesn't work for me. What is char szA[100], szB[100], szC[200];? Should I use Cstring for BOX3?
-
char szA[100], szB[100], szC[200]; int c; printf(szA,"%d",a); //here, a is a int number entered on edit box 1. printf(szB,"%d",b); //here, b is a int number entered on edit box 2. strcpy(szC,szA); strcat(szC,szB); c = atoi(szC); //here, c is the int number you want, just place it into edit box 3 This doesn't work for me. What is char szA[100], szB[100], szC[200];? Should I use Cstring for BOX3?
-
using CString + operator Eg. CString str = atoi(YourInteger); str += "2"; Sonork 100.41263:Anthony_Yio
-
char szA[100], szB[100], szC[200]; int c; printf(szA,"%d",a); //here, a is a int number entered on edit box 1. printf(szB,"%d",b); //here, b is a int number entered on edit box 2. strcpy(szC,szA); strcat(szC,szB); c = atoi(szC); //here, c is the int number you want, just place it into edit box 3 This doesn't work for me. What is char szA[100], szB[100], szC[200];? Should I use Cstring for BOX3?
Anonymous wrote: What is char szA[100], szB[100], szC[200];? :omg::omg::omg::omg::omg::omg::omg::omg::omg: I think you need to find yourself a good beginner's C++ book if you need to ask that question. Never mind string concatenation, read up about variable declaration first. Let us walk before we run.
I Dream of Absolute Zero
-
char szA[100], szB[100], szC[200]; int c; printf(szA,"%d",a); //here, a is a int number entered on edit box 1. printf(szB,"%d",b); //here, b is a int number entered on edit box 2. strcpy(szC,szA); strcat(szC,szB); c = atoi(szC); //here, c is the int number you want, just place it into edit box 3 This doesn't work for me. What is char szA[100], szB[100], szC[200];? Should I use Cstring for BOX3?
Grab some tutorials on CDialog in codeproject. Sonork 100.41263:Anthony_Yio
-
How "it doesn't work for you"? what error occurred? szA,szB,szC just are temporary char string variables.
-
oh, god...:) just attach a CString class variable with your edit box 3, and then make it equal to "szC", and then call UpdateData(FALSE) to make it show in edit box 3... ;P
-
Please help me. i am a MFC beginner , and i don't know how to combine two numbers in a dialog box. for example: when a and b are entered into Box1 and Box2, In Box3 will show "ab", NOT "a+b" . Please........HELP.
CString cstrMyNumbers(_T("")); cstrMyNumbers.Format(TEXT("%d%d"), a, b); Simple as that :-) Regards, Michael Mogensen, mm it-consult dk. ><((((º> ·.¸¸.· ><((((º> ·.¸¸.· ><((((º>