C++ AND
Suppose you wish to play football with your friend on Sunday, you call him and ask him if he's available. He says he will play football only if "it is sunny and the ball is of size 5".
If we were to write this in C++ based on the knowledge we have
But C++ provides us with an easier method that is much simpler to understand and makes more sense. AND allows us to compare two expressions and give true value.
Truth value sometimes called a logical value, is a value indicating the relation of a proposition to truth. Basically truth value refers to a value of a proposition being true or false.
For a computer true means 1 and false means 0 therefore if value of AND is true then for computer it is 1, and 0 for false.
From above truth table we understand that AND give value 1 only if all expression are true. Let us do the same for 3 expression
Now let us write a program to provide discount of 20% to members of the gym above the age of 30.