All language subtitles for 14. Logical Operators 2 - Writing Associate Logical Functions

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

OK, so now let me show you how we can basically write a couple of functions to make some relational

operations.

And we will start with something very, very nice.

We will start with writing a function that should compare between two given point.

OK, so let's say we will compare.

Let's use and equal points.

Equal points in these functions should receive just two points point B one and point B two.

And basically, all this function is going to do is to compare between all of the fields in this point

in point B one and point B two.

And we are going to say that e f p one dot x.

OK.

Very important to not use if b one equals two P2.

We talked about it.

That simply wont work, at least not for now.

So we will say that if P1.6 equals two p one dot b two that X and do p one dot y equals to B to that

y.

OK, then if that happens, then we can return.

Let's say they are equal, we will return one else.

We will return zero.

The LS is not mandatory here.

We can't simply write the return zero, but never mind.

So what we've done here is we created a function to compare between two given points.

OK, so we say equal point is a function getting two points and each compares between these two points

field by field and returning one if they are equal and zero if not, so how these function will be called,

you know, let's see.

And main.

And we have here an example.

So let's create an endpoint point.

One will be equal to one and two and we will have to, which would be equal to let's see.

Four and one.

I don't know something like that.

So we want to know if both of these points are equal, so one way to do it is basically to say, Ah,

if?

If right, and we can ask a simple question, we can ask if equal point.

Equal points, let's say equal points more correctly, if equal points on these two points point one

and point to if this result does not equal to zero.

Then it means that they are equal, so we know here.

Code related to the fact that they were equal.

The points were were are equal.

OK, so that's what we do.

We simply compare between these two points by using an equal points function.

Any of these function returns a value that is not zero like in this case, we can say simply that.

They are equal.

OK?

Is it clear?

So we couldn't use it the equality sign.

Like if b one equals equals to two?

But we can use it this way by using equal points.

OK.

So basically here you will write down any code associated with the result of this condition being true

or if it's false, related to the yellow section.

OK.

Another example if we want to write down a function that basically compares between two points and says

not equal points, not equal points.

OK, so this was kind of associated with this relational operator.

Right?

And this one will be associated with.

This relational operator not equal, so it will also get point B one in point P2, but all he's going

to do is something else.

What is it going to do?

It's going to compare between them a little bit differently.

If P1.6 does not equal to be 2.6 or OK, right, we can copy that.

We can say you could be one that does not equal to P2 Reddick's.

Or at least be wonder why does not equal to be two that way, then we can return one.

Otherwise we can return zero.

OK, very, very simple.

So we created two functions kind of associated with the equality and not equality.

Lodge relational operators.

Of course, we could have used the implementation of this function, not equal points, by calling the

equal points and basically stating the opposite result OK, return, not equal points.

Well, I did the the most trivial way.

OK, so that's one way to use the relational operators.

OK.

So in C, we cannot use operator overloading, which is the whole topic on itself.

But in C++, the basically the arm operator overloading section is one of its biggest features.

OK, so that's something that I recommend you to also learn.

OK, here we are in this way.

Here we will learn it this way.

OK, so that's just two examples to the using the points.

And also, let's use, I don't know some additional example on like how we can compare between employees.

So let's create something.

OK, let's say ain't.

Equal by age, and we will receive two employees, we will receive employee e one and we will receive

employee employer.

E e two, so there are going to be two employees and we are going to compare them by age, so we are

going to ask a simple question if you want what age?

Right, if E one dot h.

And we can make these function even more unique, if it's equal to equal to that age, then we can return

zero.

Right.

But if, OK, we can use the else, it's not mandatory, but just for simplicity, let's use it.

But if you want that age is less, then e to that age.

Then we can decide on some, I don't know, signature for our own return minus one.

And else, if that's not the case, this is referred to e to.

Don't age or wonder age greater than E to that age.

OK, that's so then we will return one.

So.

We have written some function.

OK, maybe instead of equal, we will use compare by age.

And this function is responsible for comparing to employees variables two variables of an employee type

by age.

So this function is of the following structure If both of the employees have the same age, then the

function is going to return zero.

If the first stage, the first employee is younger than the second one, then we are going to return

one.

And if the second employee is younger than the first one, we are going to return one.

OK, so minus one one in zero.

That's just something that we've created to kind of mimic the relational operations between two elements

two variables of an employee type.

OK.

By comparing the age, we could also do pretty much the same just by comparing their IDs, right?

We can compare by I.D..

We can compare by aid, so if I did.

And that's the case and the same here and the same here, right?

Pretty much so.

Now in the main function, we will be basically able to create variables of an employee type.

And then if we need it, we can call these functions compare by idea.

We can call these function, compare by age and basically provided with two employees.

And these functions are going to compare them by one of these fields.

We can also use it for comparing by name, right?

There is also an option to do that.

But I think you've got the idea of how we can use it to our advantage.

So we hope that everything regarding this matter is clear to you.

And yeah, thank you guys for watching.

Let's proceed.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.