• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Truth table for Loops

 
Win jones
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys can someone help me out with a truth table that has worked out for them. I am having serious trouble solving questions that involve loops with a number of variables and conditions, I usually end up wasting a lot of time and getting a result that is not part of the choice .
I tried the truth table i.e one for each variable defined and after that I get confused half way thru. Any help would greatly increase my scores. I do understand that it might sound like a trivial request but I am losing lots of points here. Please share any methods that has worked for you.

Thanks
 
Jay Pawar
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jones,
Can you post one complex loop as an example ? I will give a try to come up with truth table.
 
Win jones
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jay,
How about this piece



Thanks
 
Anusorn Swasdee
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for interrupting. <hope both of you not angry>
But when I find something like this.
I just write table of progressing values in a piece of paper.
And go through the program while keep writing changed value.
I'm not writing the truth table because the truth table only decide
which code to do or not to do or which way to go < I use my finger to
indecate where I am now in which parts of code.>

<the testing center provides paper and pen, if not, use notepad>



[ January 06, 2005: Message edited by: Anusorn Swasdee ]
 
Win jones
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Anusorn,
Thats how I do it too , how about the conditions - u just remeber at each step and also the pre n post increment decrement if any - is there any way to capture all that .... Thanks for prev post
 
Anusorn Swasdee
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Er...
How about rewriting the code to make it easier and less complex.



and make some syntax error on purpose like this



Hope this will help
Anusorn
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic