Hello.
Welcome to this lecture.
In this lecture, we're going to learn about the logical operators here.
So these are the logical operators, which I will explain and you will learn in this lecture.
So the logical operators evaluate Boolean logic on bool types.
So you characterize operators by how many operands they take.
So a unary operator here takes a single parent, and a binary operator takes two.
A ternary operator takes three and so on.
So you can categorize operators further by describing the types of their operands.
So the unary negation operator here, this not operator takes a single operand and returns its opposite.
In other words, a urinary.
Here, let me write text this here if you write like.
Your honorary crew.
You know true.
You will get the false here.
Here.
Let me actually.
Okay.
Not operator.
Here.
And make it left all the way.
So this you will if you put the true in this in this operand, you will get the false or bitwise here.
If you give the false, you will get true.
So this takes only one apparent and not apparent takes only one operation.
So and the other negotiation.
This is the union negotiation operator here but the logical operators, for example, and plus and or
operator here this is or so this is and and this is or so the logical end returns true only if both
of its operands are true.
So if, for example.
Um.
True.
True and true, then this equals to true.
But if you give this apparent the true and false true.
And false, you will get the files.
So actually, it might be complicated here, but I promise you will learn all about this options here.
So at first.
Yeah, it will.
You still see this?
Appearance?
Complicated, but it's not that complicated at all.
So.
Let's make the OR operator here.
So this is the OR operator.
So if you.
All logical or here logical or if you give the true.
If either of the both of its operands are true, then it returns true, for example.
So if for for example, I have false and true, this will get or let's make it more understandable if
I have true and true or false and false, it doesn't matter.
Here.
It's appearance false.
You will get true.
Now.
You will get false.
But if you give true and.
Pulse, you will get false two.
You will get true.
Sorry for this.
So if you have just one true, you will get the true here.
But if you have to false which is zero, you will get the false with this operator.
So logical operators might seem confusing at first, but they quickly become intuitive.
So let's open our Visual Studio code here.
This is our Visual Studio code.
Okay.
So this is our Visual Studio code.
Let's delete the previous lectures.
Here.
This is all the lectures which you can download these codes in the downloadable sections of this Udemy
course Oxley.
So let's create some.
Courtier.
Okay, so let's create, for example, bool, bool.
So this is the bool.
As you know, in previous lectures we learned about the bull type.
For example, True equals true.
Bull f with this means false.
Equals false here.
And let's create our illustrations with our common line here.
And so printf.
Printf.
Let's start.
Let's start with, um.
Let's start with the not operator here.
Uh.
Okay.
So let's start with note, Operator.
We will illustrate in code.
True.
The and new line.
Here a new line and gave this the let's give this the real operator here.
True.
As you can see here, we gave the we use this ternary this not operator and we operated this true.
So after after this, you will see what it will give to us and then print f.
So let me mention here.
The one is true and the zero is false.
This is the pretty common information here.
The one is true and zero is false, but some of you might not know about this.
So in case I wrote this down here and let's continue on the next line here, the true and.
Through true and false.
Uh, the.
A new line.
Let's see.
Um, t.
And false.
T and false.
And let's continue with as I always do, I will explain all of these codes later when we extract and
run these codes.
So print F.
True.
And here we will.
Printf.
True.
Here, we will see the true and.
Not false.
And let's create the here.
That's all.
Which will give us the 0 or 1 in case it's zero.
It will give us the zero.
It will give us the false.
But in case it's the one, which is it will the compiler will show us the one here.
So.
Then let's give this the.
True.
And.
True and not false.
Not false.
Not f here.
And let's add another line of code here.
Print f.
True or true.
True or false?
Here.
Ops.
Here.
Well, actually, it's okay.
True or false and gave this true.
Interpreters here.
Pulse.
Uh, f here.
So, as you know, here we have a boolean variable which named T is true, and boolean variable named
F is false.
Here and print F plus.
This is the last line of code which after this you will know about and I will explain the all of these
code lines later, line by line and false.
Or operator?
False.
Falls here.
And the new line here, we will get the F.
F here.
Lastly and then let's save our code and run our program.
CMD Where was our program?
Here, let me find it.
Okay, dear.
See desktop.
Dear here three desktop dear.
Okay, so let's compile our application here.
GCC color so GCC or clear.
Firstly, GCC main dot main.cpp here our code is compiled without an error.
And then let's run this program.
A dot x here.
So as you can see here, we have these codes.
So let's copy this codes here.
Oops.
Here.
And copy and paste these codes in our diagram to explain it more.
Here.
Oops.
What the.
Okay.
Actually we can do this in.
Right.
So.
Let's explain these codes one by one.
Here the at the first you see the negotiation operator.
Which is false.
So if true is not true, then it's false.
So it gave us the zero, which is false.
And the second here.
Second.
True.
Not true.
Operator.
Here.
Or not true.
True and.
And false Here.
If true.
And then false.
Uh, as I said, uh, if you use true in order in order to you, if you have to get true from this end.
Operator, you need to give the twice to true operators in this operand here.
So as you shown here, we get we got the zero from this operation.
And then true and not false.
So if it's not false, we will get the true true or false.
We will get the one, as I explained in this lecture at the beginning.
And if false or false, it will give give us a zero.
Because in order to work with get one from or operator, we need at least one.
True in our operation.
So I'm waiting you in the next lecture, which in the next lecture we will learn the new type here.
Standard by type.
So I'm waiting you in the next lecture.