-
If you want the source**, I can make one and send it to you.
Order 3 edit controls from top to bottom as edit1, edit2, edit3;
Use the class wizard to associate a string variable with each of these three box controls: m str1, m str2, m str3;
Double-click the 1+1=2 button control, and write :
updatedata(true);You can get data from the control.
int m,n,sum;
m=atoi(m_str1);Convert strings to ints.
n=atoi(m_str2);
sum=m+n;
itoa(sum,m_str3,10);Convert an int to a string.
updatedata(false);The resulting string m str3 is displayed on the control.
-
In the resource (that is, the thing you draw the interface), double-click the "Execute 1+1=2" button, and a ** window will pop up, add the following ** (provided that the IDs of the 3 boxes you draw are IDC ED1, IDC ED2, IDC EDT3 at a time):
int nnum1;
int nnum2;
cstring str;
getdlgitemtext(idc_edit1, str);Gets the text content of the first box.
nnum1 = atoi(str);Converts the acquired text content into numeric values.
getdlgitemtext(idc_edit2, str);
nnum2 = atoi(str);
d", nnum1 + nnum2);Converts the result of the addition to text.
setdlgitemtext(idc_edit3, str);Sets the text for the third box.
If you want to learn how to program MFC dialogs, you can take a look at this link provided below.
-
Steps: 1. Write a simple program with bugs;
2. Run the program, generate an error, and directly press the shortcut key F10 for debugging;
3. With intuition, set the number of delayed breakpoints;
4. Observe the change of variables, whether it is within the required range, or whether the program produces memory overflow when transporting potato shirts, and finally finds that an error occurs when a is equal to 1, and then runs after correction;
5. Recompile after modifying the program, if there is no error, it will be completed, if there is an error, continue to the third and fourth steps until the error is eliminated or the correct result is produced.
Note: When debugging in VC, you should set a breakpoint and a full-speed running phase collapse cover to debug the program, which is helpful to quickly debug the program.
Hello landlord, whether it can be connected depends on whether the thread is the same, as long as the thread can be done. Because the cone does not seal, there are two types of sealing: one is a threaded seal, such as: >>>More
In a beautiful big forest, a little monkey is playing happily in a tree. When he was picking fruit from a tree to eat, he found that something seemed to be flashing on the ground, like a ruby, and he went to the bottom of the tree and picked up the "ruby" and smelled it curiously, saying, "Huh? >>>More