Click here to Skip to main content
15,915,834 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How do I get a menu bar by using a resource ID? Pin
KellyR24-Jun-08 9:44
KellyR24-Jun-08 9:44 
AnswerRe: How do I get a menu bar by using a resource ID? Pin
Hamid_RT27-Jun-08 7:49
Hamid_RT27-Jun-08 7:49 
Questionan easy one: importing from dll Pin
bulg24-Jun-08 8:27
bulg24-Jun-08 8:27 
AnswerRe: an easy one: importing from dll Pin
Cedric Moonen24-Jun-08 8:34
Cedric Moonen24-Jun-08 8:34 
QuestionEvaluating a user generated boolean query Pin
wolfsburged24-Jun-08 7:39
wolfsburged24-Jun-08 7:39 
QuestionRe: Evaluating a user generated boolean query Pin
David Crow24-Jun-08 7:49
David Crow24-Jun-08 7:49 
AnswerRe: Evaluating a user generated boolean query Pin
wolfsburged24-Jun-08 8:04
wolfsburged24-Jun-08 8:04 
AnswerRe: Evaluating a user generated boolean query Pin
Niklas L25-Jun-08 1:16
Niklas L25-Jun-08 1:16 
Actually it's really not that hard to write an evaluation function for this. Use a stack to push all tokens from left to right. Using the following rules using the above example ((X && Y) || Z)

1. If token is a variable, push its value, else push the token.
2. After each push, check if the top of the stack can be evaluated.
3. After each evaluation, check if the stack can be evaluated further.
4. When no more tokens, the result is in the stack.

When checking if the top can be evaluated:
1. Check for unary operators in stack top - 1
else
2. Check for binary operators in stack top - 1
else
3. Check for parentheses in stack top - 2 and top

(You may also want to check the surrounding values to make sure they are what they are supposed to be, unless you know you have a correct statement syntax)

Example
push (
push (
push X => TRUE
push AND
push Y => FALSE // Evaluation rule 2 applies
  // stack now ( ( FALSE
push ) // Evaluation rule 3 applies
  // stack now ( FALSE
push OR
push Z => TRUE // Evaluation rule 2 applies
  // stack now ( TRUE
push ) // Evaluation rule 3 applies
  // stack now TRUE

There are no more tokens and the result is in the stack. If the stack size is larger than 1, there is an error.

I bet this was not the answer you were hoping for.


GeneralRe: Evaluating a user generated boolean query Pin
wolfsburged27-Jun-08 4:19
wolfsburged27-Jun-08 4:19 
QuestionUsing VC++ 2008 compiler with VC++ 2005, but keep compatibility with Win98 ? Pin
Defenestration24-Jun-08 5:54
Defenestration24-Jun-08 5:54 
AnswerRe: Using VC++ 2008 compiler with VC++ 2005, but keep compatibility with Win98 ? Pin
toxcct24-Jun-08 5:57
toxcct24-Jun-08 5:57 
GeneralRe: Using VC++ 2008 compiler with VC++ 2005, but keep compatibility with Win98 ? Pin
Defenestration24-Jun-08 6:06
Defenestration24-Jun-08 6:06 
GeneralRe: Using VC++ 2008 compiler with VC++ 2005, but keep compatibility with Win98 ? Pin
toxcct24-Jun-08 6:18
toxcct24-Jun-08 6:18 
GeneralRe: Using VC++ 2008 compiler with VC++ 2005, but keep compatibility with Win98 ? Pin
Defenestration24-Jun-08 10:55
Defenestration24-Jun-08 10:55 
AnswerRe: Using VC++ 2008 compiler with VC++ 2005, but keep compatibility with Win98 ? Pin
JudyL_MD24-Jun-08 10:39
JudyL_MD24-Jun-08 10:39 
GeneralRe: Using VC++ 2008 compiler with VC++ 2005, but keep compatibility with Win98 ? Pin
Defenestration24-Jun-08 10:56
Defenestration24-Jun-08 10:56 
GeneralRe: Using VC++ 2008 compiler with VC++ 2005, but keep compatibility with Win98 ? Pin
JudyL_MD25-Jun-08 2:03
JudyL_MD25-Jun-08 2:03 
AnswerRe: Using VC++ 2008 compiler with VC++ 2005, but keep compatibility with Win98 ? Pin
Joe Woodbury24-Jun-08 11:07
professionalJoe Woodbury24-Jun-08 11:07 
AnswerPossible solution to getting VC++ 2008 compiled apps to run on Win98... Pin
Defenestration24-Jun-08 12:24
Defenestration24-Jun-08 12:24 
Questionresource.h corruption Pin
Like2Byte24-Jun-08 4:01
Like2Byte24-Jun-08 4:01 
AnswerFound it on Code Project! Pin
Like2Byte24-Jun-08 4:50
Like2Byte24-Jun-08 4:50 
QuestionMDI child windows in the task bar Pin
Sylv3324-Jun-08 3:51
Sylv3324-Jun-08 3:51 
AnswerRe: MDI child windows in the task bar Pin
_S_R_M_24-Jun-08 4:15
_S_R_M_24-Jun-08 4:15 
Question0xC000001D "Fatal Application Error" ???? Pin
Trupti Mehta24-Jun-08 2:50
Trupti Mehta24-Jun-08 2:50 
AnswerRe: 0xC000001D "Fatal Application Error" ???? Pin
Rajesh R Subramanian24-Jun-08 3:15
professionalRajesh R Subramanian24-Jun-08 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.