14,838,477 members
Home / Discussions / C / C++ / MFC

# C / C++ / MFC

 Re: Retrieve HWND of a control that has focus leon de boer12-Aug-18 3:47 leon de boer 12-Aug-18 3:47
 What is the magic incantation to select a row in a CListCtrl in report mode ? Maximilien9-Aug-18 9:09 Maximilien 9-Aug-18 9:09
 Re: What is the magic incantation to select a row in a CListCtrl in report mode ? David Crow9-Aug-18 9:47 David Crow 9-Aug-18 9:47
 Re: What is the magic incantation to select a row in a CListCtrl in report mode ? Maximilien9-Aug-18 12:06 Maximilien 9-Aug-18 12:06
 Re: What is the magic incantation to select a row in a CListCtrl in report mode ? Maximilien21-Aug-18 5:11 Maximilien 21-Aug-18 5:11
 how to use recursive descent algorithm to compute an arithmetical expression? tony_ming8-Aug-18 20:42 tony_ming 8-Aug-18 20:42
 Re: how to use recursive descent algorithm to compute an arithmetical expression? Richard MacCutchan8-Aug-18 20:50 Richard MacCutchan 8-Aug-18 20:50
 Re: how to use recursive descent algorithm to compute an arithmetical expression? Stefan_Lang8-Aug-18 22:07 Stefan_Lang 8-Aug-18 22:07
 The logic in your parse functions is flawed: it first looks for the operator, and only then looks for the arguments. This would only work for an expression like "+ 1 2" rather than "1 + 2". You have to change your code to first split it into tokens and then check the second (and maybe following) token(s) of the remaining part of your expression string for operators, before passing the first token(s) and the rest of the tokens (after the operator) on to the next recursion step. P.S.: It is always a bad idea to use global variables in a program. But it is especially devastating when using recursive functions! I don't see any reasonable way to implement E(), T() and F() without passing the part of the string that needs to be analyzed. The advantage is that you don't need to split the whole string into tokens up front as I suggested at first. Instead each function just searches its part of the string for the operators that it can interpret, extract the arguments of that operator accordingly, and pass those into further recursive calls. P.P.S.: example for function E(): Copy Code ```double E (const std::string& str) { size_t op_pos = str.find_first_of("+-", 1); // search for '+' or '-' starting at the second character of the string if (op_pos == std::string::npos) { // not found return T(str); } std::string first_operand = str.substr(0, op_pos); std::string second_operand = str.substr(op_pos+1); return (str.at(op_pos) == '+') ? E(first_operand) + T(second_operand) : E(first_operand) - T(second_operand) }``` GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)modified 9-Aug-18 4:43am.
 Re: how to use recursive descent algorithm to compute an arithmetical expression? David Crow9-Aug-18 4:55 David Crow 9-Aug-18 4:55
 Re: how to use recursive descent algorithm to compute an arithmetical expression? CPallini9-Aug-18 10:38 CPallini 9-Aug-18 10:38
 MovePrev() throwing 265926 error code (End Of RowsSet). Sampath5797-Aug-18 20:19 Sampath579 7-Aug-18 20:19
 Re: MovePrev() throwing 265926 error code (End Of RowsSet). Jochen Arndt7-Aug-18 21:52 Jochen Arndt 7-Aug-18 21:52
 Re: MovePrev() throwing -2147217837 error code Sampath5797-Aug-18 22:23 Sampath579 7-Aug-18 22:23
 Re: MovePrev() throwing 265926 error code (End Of RowsSet). Jochen Arndt7-Aug-18 23:26 Jochen Arndt 7-Aug-18 23:26
 Re: MovePrev() throwing 265926 error code (End Of RowsSet). Sampath5798-Aug-18 0:01 Sampath579 8-Aug-18 0:01
 Re: MovePrev() throwing 265926 error code (End Of RowsSet). Jochen Arndt8-Aug-18 0:29 Jochen Arndt 8-Aug-18 0:29
 Re: MovePrev() throwing 265926 error code (End Of RowsSet). Sampath5798-Aug-18 3:19 Sampath579 8-Aug-18 3:19
 Re: MovePrev() throwing 265926 error code (End Of RowsSet). Jochen Arndt8-Aug-18 3:21 Jochen Arndt 8-Aug-18 3:21
 Re: MovePrev() throwing -2147217837 error code. Sampath57912-Aug-18 1:36 Sampath579 12-Aug-18 1:36
 Re: MovePrev() throwing 265926 error code (End Of RowsSet). David Crow8-Aug-18 4:45 David Crow 8-Aug-18 4:45
 Re: MovePrev() throwing 265926 error code (End Of RowsSet). Sampath5798-Aug-18 5:16 Sampath579 8-Aug-18 5:16
 Re: MovePrev() throwing 265926 error code (End Of RowsSet). David Crow9-Aug-18 4:56 David Crow 9-Aug-18 4:56
 Re: MovePrev() throwing 265926 error code (End Of RowsSet). Stefan_Lang8-Aug-18 21:44 Stefan_Lang 8-Aug-18 21:44
 Re: MovePrev() throwing -2147217837 error code Sampath57912-Aug-18 5:29 Sampath579 12-Aug-18 5:29
 MFC Icon indicator (red/green) Maximilien6-Aug-18 7:20 Maximilien 6-Aug-18 7:20
 Last Visit: 31-Dec-99 18:00     Last Update: 18-Apr-21 16:46 Refresh ᐊ Prev1...151152153154155156157158159160 Next ᐅ