Welcome to Dream.In.Code
Click Here
Getting Help is Easy!

Join 118,483 Programmers for FREE! Ask your question and get quick answers from experts. There are 961 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Logic Operators and how they are interpreted

 
Reply to this topicStart new topic

> Logic Operators and how they are interpreted

polymath
Group Icon



post 31 May, 2008 - 08:51 AM
Post #1


The attached file is a tutorial on Logic Operators.

I used some elements that i didn't know how to use in BBcode, such as tables, so if anyone could tell me how to make a table for my tutorials, that would be appreciated. For now, here it is in Rich Text (hope you can open it).

smile.gif


Attached File(s)
Attached File  Logic_Operators_Tutorial.rtf ( 67.14k ) Number of downloads: 71
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

mikeblas
**



post 1 Jun, 2008 - 09:43 AM
Post #2
Unfortunately, BBCode doesn't support any sort of tables.
Go to the top of the page
+Quote Post

NickDMax
Group Icon



post 1 Jun, 2008 - 02:36 PM
Post #3
Well, what you can do is use some creative work to create tables.

First set you font to a fixed width font (courier or new courier work well).

Next layout your table as you would like it using ascii art.

Then use your text editor (something that has RegEx replaces works best -- I use ProgrammersNotepad) to replaces spaces with a period (or other small character).

Then replace all of the instances of that character with [color=#FFFFFF](spaces char here)[/color]

I use Programmer's Notepad's RegEx replace to do this. It works well. but since Dream In Code's background is not exactly white the characters are still visible but barely, and if someone copies your text then they get all of those characters.

example:

+---------+---------+----------+
|````X````|````Y````|`(X`&&`Y)`|
+---------+---------+----------+
|`Flase```|`False```|`False````|
+---------+---------+----------+
|`False```|`True````|`False````|
+---------+---------+----------+
|`True````|`False```|`False````|
+---------+---------+----------+
|`True````|`True````|`True`````|
+---------+---------+----------+


CODE
[font=Courier New]+---------+---------+----------+
|[color=#FFFFFF]````[/color]X[color=#FFFFFF]````[/color]|[color=#FFFFFF]````[/color]Y[color=#FFFFFF]````[/color]|[color=#FFFFFF]`[/color](X[color=#FFFFFF]`[/color]&&[color=#FFFFFF]`[/color]Y)[color=#FFFFFF]`[/color]|
+---------+---------+----------+
|[color=#FFFFFF]`[/color]Flase[color=#FFFFFF]```[/color]|[color=#FFFFFF]`[/color]False[color=#FFFFFF]```[/color]|[color=#FFFFFF]`[/color]False[color=#FFFFFF]````[/color]|
+---------+---------+----------+
|[color=#FFFFFF]`[/color]False[color=#FFFFFF]```[/color]|[color=#FFFFFF]`[/color]True[color=#FFFFFF]````[/color]|[color=#FFFFFF]`[/color]False[color=#FFFFFF]````[/color]|
+---------+---------+----------+
|[color=#FFFFFF]`[/color]True[color=#FFFFFF]````[/color]|[color=#FFFFFF]`[/color]False[color=#FFFFFF]```[/color]|[color=#FFFFFF]`[/color]False[color=#FFFFFF]````[/color]|
+---------+---------+----------+
|[color=#FFFFFF]`[/color]True[color=#FFFFFF]````[/color]|[color=#FFFFFF]`[/color]True[color=#FFFFFF]````[/color]|[color=#FFFFFF]`[/color]True[color=#FFFFFF]`````[/color]|
+---------+---------+----------+[/font]
Go to the top of the page
+Quote Post

herefishyfishy
Group Icon



post 2 Jun, 2008 - 06:07 PM
Post #4
I'd just like to comment on your distributive property of logic.

There IS a way to simplify !(A&&B). It's the same as !A||!B.

Likewise, !(A||B) is logically equivalent to !A&&!B.

It's called De Morgan's law. (Yes, I am such a nerd. I know.)

This post has been edited by herefishyfishy: 2 Jun, 2008 - 06:08 PM
Go to the top of the page
+Quote Post

KYA
Group Icon



post 3 Jun, 2008 - 04:40 AM
Post #5
Nice! I also like math theory go De Morgan!
Go to the top of the page
+Quote Post

baavgai
Group Icon



post 3 Jun, 2008 - 05:58 AM
Post #6
QUOTE(herefishyfishy @ 2 Jun, 2008 - 09:07 PM) *

There IS a way to simplify !(A&&B). It's the same as !A||!B.


Good point. From a computer standpoint, !A||!B might be preferable to !(A&&B).

The reason is that if !A is true, the compiler doesn't have to resolve !B and usually won't. For A&&B the same thing, If !A is can just stop. However, further logic is to be applied, it would have to resolve the entire thing. That's assuming the compiler doesn't distribute the logic first, but it's something to be aware of.
Go to the top of the page
+Quote Post

polymath
Group Icon



post 3 Jun, 2008 - 01:15 PM
Post #7
I heard about DeMorgan's Law, but thought that the tutorial was already a lot to swallow for a total beginner. Most of my tutorials (actually, i think at this point all of them) are aimed twoard beginners. Thats what i think is the most rewarding thing about writing tutorials: helping people who aren't as good as you yet. Anyway if i edit the tutorial post i will include DeMorgan's Law. Thanks for reminding me about that one thing. Also, thanks to all of you for your help.
Go to the top of the page
+Quote Post

polymath
Group Icon



post 4 Jun, 2008 - 01:28 PM
Post #8
Whats the need for the small char instead of spaces?
Go to the top of the page
+Quote Post

NickDMax
Group Icon



post 14 Jun, 2008 - 12:28 PM
Post #9
The forum software will compress multiple spaces into a single space. So to keep the spacing for the table you have to insert some character in there. Then to ensure that that character is not displayed you need to mask it to the background color (which not really white, but I find that it is close enough for me).
Go to the top of the page
+Quote Post

herefishyfishy
Group Icon



post 23 Jun, 2008 - 02:20 PM
Post #10
Another comment on the supposedly nonexistent distributive property of logic...

There is a property which states that A||(B&&C)==(A||B)&&(A||C). Likewise, A&&(B||C)==(A&&B)||(A&&C).

This property just happens to be called the distributive property.

I could tell you lots of stuff...
  1. A||A==A
  2. A&&A==A
  3. A||(!A)==true
  4. A&&(!A)==false
  5. A&&(A||B)==A
  6. A||(A&&B)==A
  7. A||B==B||A
  8. A&&B==B&&A
  9. (A||B)||C==A||(B||C)
  10. (A&&B)&&C==A&&(B&&C)
  11. !(!A)==A
  12. A||(B&&C)==(A||B)&&(A||C)
  13. A&&(B||C)==(A&&B)||(A&&C)
  14. !(A&&B)==!A||!B
  15. !(A||B)==!A&&!B
  16. A||true==true
  17. A&&true==A
  18. A||false==A
  19. A&&false==false
The list goes on and on...

This post has been edited by herefishyfishy: 23 Jun, 2008 - 02:20 PM
Go to the top of the page
+Quote Post


Fast ReplyReply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 10/11/08 06:12AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month