24point procedures (3)

xiaoxiao2021-03-06  13

The last reinstall system, accidentally wrote the procedures written in the previous few times. Depressed...................................

However, this 24-point applet is basically half-finished, or it is designed from the beginning. It is better to write into blog in the previous key information, so it is more fast.

It is now written to represe infix expressions with a string. I wrote a lot of hours to find that my basic is so unsound. Several strings turned to my dizzy, so I looked for deception, the group asked, online post. I finally put this conversion to get it, now I feel that the master's master is sublimated.

Here is what I wrote today.

void CMy24pointDlg :: OnPrint () {// TODO: Add your control notification handler code here // number of blocks of received / * UpdateData (); GetDlgItemInt (IDC_NUM1, & RecvNum [0], FALSE); GetDlgItemInt (IDC_NUM2, & Revnum [1], FALSE); Getdlgitemint (IDC_NUM3, & Recvnum [2], False); getdlgitemint (IDC_NUM4, & Recvnum [3], false); Updatedata (TRUE); * /// update (); // Judgment Receive Number range for (INT i = 0; i <4; i ) {if (SRANDNUM [I]> 12 || SRANDNUM [i] <= 0) {MessageBox ("Your number exceeds range, please enter 1 --- 12 of 12 "); // Return 0;}} // Generate prefix expression // Define a character array to store prefix expression char buffer [12];

// The values ​​of ABCD indicate the addition and subtraction // A, B, C, and D, respectively, 97 98 99 100 INT add = 97; int SUB = 98; int = 99; int DIV = 100; // -------------------------------------------------- ---------------------------------------- // Take all algorithms with addition and subtraction (int first <= add; first ) for (int second = add; second <= div; second ) for (int third = add; third <= div; third ) {// This is completed, The above numbers are converted into strings, // Then then add add, SUB. . . .

After converting into the ASCII code, the character digital char flag in the converted expression is stored in the string //, and the character number of the infix expressions is stored in FLAG1 and FLAG2, respectively, Flag2 [1]; / / ================================== === Set the first number ====================== / (SRANDNUM [0]> = 10) {//// / Numbuffer [0] stores the first bit and numbuffer [1] to store the second bit // random number INT Numbuffer [2] used to store randomly generated 2 digits; int m = 0; int Temp = SRANDNUM [0]; WHILE (M <2) {Numbuffer [1-m] = Temp% 10; Temp = Temp / 10; M ;} flag1 [0] = Numbuffer [0] 48; Flag2 [0] = Numbuffer [ 1] 48; Buffer [0] = flag1 [0]; buffer [1] = flag2 [0];} else {flag1 [0] = 0 48; buffer [0] = flag1 [0]; buffer [1 ] = SRANDNUM [0] 48;} // ================= Set the first symbol ================ ==== // buffer [2] = first; // ================ set the second number ============== ======= // if (SRANDNUM [1]> = 10) {// Store the first bit and numbuffer [1] with Numbuffer [0] to store the second bit // to store random generation 2 Random number INT Numbuffer [2]; int m = 0; int Temp = SRAN DNUM [1]; While (M <2) {Numbuffer [1-m] = Temp% 10; Temp = Temp / 10; M ;} flag1 [0] = Numbuffer [0] 48; Flag2 [0] = Numbuffer [1] 48;

Buffer [3] = flag1 [0]; buffer [4] = flag2 [0];} else {flag1 [0] = 0 48; Buffer [3] = flag1 [0]; buffer [4] = SRANDNUM [1 ] 48;} // ================= set the second symbol ===================================================== / Buffer [5] = second; / / ================ set third number =================== == // if (SRANDNUM [2]> = 10) {// Staves the first bit and numbuffer [1] with Numbuffer [0] to store the second bit // randomly used to store randomly generated 2 digits INT Numbuffer [2]; intimp = SRANDNUM [2]; while (m] {Numbuffer [1-m] = temp% 10; Temp = Temp / 10; M ;} flag1 [0 ] = Numbuffer [0] 48; Flag2 [0] = Numbuffer [1] 48; buffer [6] = flag1 [0]; buffer [7] = flag2 [0];} else {flag1 [0] = 0 48; buffer [6] = flag1 [0]; buffer [7] = SRANDNUM [2] 48;} // ================= set third Symbol =================== // buffer [8] = third; // ================ set Four numbers ======================= ing (SRANDNUM [3]> =

10) {// Use Numbuffer [0] to store the first bit and numbuffer [1] to store the second bit // random number INT NumBuffer [2] used to store randomly generated 2 digits; int m = 0; INT TEMP = SRANDNUM [3]; while (m <2) {Numbuffer [1-m] = temp% 10; TEMP = TEMP / 10; M ;} flag1 [0] = Numbuffer [0] 48; Flag2 [0 ] = Numbuffer [1] 48; Buffer [9] = flag1 [0]; buffer [10] = flag2 [0];} else {flag1 [0] = 0 48; buffer [9] = flag1 [0] ; Buffer [10] = SRANDNUM [3] 48;} // =========== set the last end of the end of ================= == // buffer [11] = 0;} MessageBox (buffer); // ------------------------------- -------------------------------------------------- ------}

At the time of the design above, there is still no idea that when you actually write, you will find that the random number is 1 and 12, sometimes it is 2 digits, so it is more troublesome.

The above code has not been completed, but the above code is still a problem.

Be

GetDlgItemInt (IDC_NUM1, & RecvNum [0], FALSE); GetDlgItemInt (IDC_NUM2, & RecvNum [1], FALSE); GetDlgItemInt (IDC_NUM3, & RecvNum [2], FALSE); GetDlgItemInt (IDC_NUM4, & RecvNum [3], FALSE);

I don't know why I can't receive numbers in the dialog.

I used the updatedata () function, I am really strange.

There is also a place that is very cumbersome -------- is when setting the first to the fourth number, just use a full-time function, this is going back to resolve.

It is now completed by basic auxiliary measures.

The following is the application of the stack, those are the key.

转载请注明原文地址:https://www.9cbs.com/read-49237.html

New Post(0)