• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Truth table for Loops

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jay,
How about this piece



Thanks
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Yup, yup, yup. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic