All language subtitles for 19. Distance Between 2 Points - Solution

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

So let's find the distance between two given points.

So first of all, we have this first point.

So it was something like this one y one.

And we have another point, which is the X2 and Y two.

OK, awesome.

So what we have to do is to apply some formulas and rule that we found out previously and it goes like

this.

So the distance between two points equals to square root.

So security of X one, OK, X one minus X to all of that in the power of two plus right.

Y one minus Y two and a square root.

And all of this going to be under this square root in, in the power of two.

OK, and all of the result is going to be applied a square root.

So let's first of all, just create all of these values.

So let's go with a floating point type.

So shall we.

So float X one Y one X to Y to OK.

And now we'll simply read the values from the user.

So there are a couple of approaches to read all of these values.

Let's use the most obvious one.

OK, so just print F, answer X one, OK?

And then read it using this kind of function percentage F and store it inside of variable X one and

now simply copy these two lines over and over again for all of our variables.

So X one it will be x2 or maybe let's use here.

Now this is one Y one Y one a X two weeks to Y to and here also Y two.

OK, so we are going to read X one, Y one x2 and Y two.

And once we are done reading this information, there are also a couple of approaches.

But what we are going to do now is to simply just include in your library that contains a lot of mathematical

operations.

So we are going to use here include math dot h.

Right.

We said previously that we are including in most of our programs in this course, the standard input

output library.

OK, yesterday we will talk about it, but I'm not sure that it will be in these course in the more

advanced course.

But basically the audio is the standard of the input output which contains and functions such as print

F and scan F and so on.

Some functions that refer to input and output operations.

And now what we have to do is simply to print the distance, so let's create additional variable, let's

call this variable Flude distance and distance will be equal to distance will be equal to what distance

will be equal to ask you r t you can see that this function.

OK, this is kind of function.

It applies a square root on a given number inside of these parentheses.

So that's something that the math that H gives us.

So security in here, we will specify, let's say that we even do not know exactly what is the specification

of taking some value and applying the power of two on it.

So we will simply go like this x1 minus x2 multiplied by the same x1 minus six to write.

The result will be the same as the power of two.

And we take all of that and simply added like y one minus Y two multiplied by Y one minus one Y two.

So that's basically the formula for finding the distance in this case.

So that's how you find the distance.

The is a mathematical operation that exists in this math that H library.

So that's awesome.

And now all that remains to do is to print the result to the screen.

So simply take the following print of command and the distance, the distance between the points.

OK, so let's say between the points here, let's use a very descriptive message, percentage F percentage,

if it's just limited to be like point two and point two.

OK.

So the distance between the points.

OK, that's the first point and the second point, which is also going to be represented like this.

OK, so percentage point to F so that's the distance.

That's the point is and now we are going to specify the distance itself, which is also going to be

of a floating point type.

So that's how it should be done.

And now here we are going to specify the exact values.

So for the first percentage, if it's X one and the second one is Y one, x two, white two.

OK, so we covered both of these points.

And finally, we have also to specify the distance, which is distance.

OK, so we found laid out here, we calculated it on line twenty seven, use a semicolon at the end

and basically I think that we are ready to build and run it.

So let's go build and run and we have a problem here.

OK, we forgot these parentheses.

OK.

So yeah.

So build and run and so enter x1.

Let's make it.

Um I don't know maybe let's go with one and y one will be equal to let's say just for simple calculation

three and now let's use here x2 is four and this one is seven for example.

OK, so we will get here that both of the points are one in three, four and seven and the distance

is fine because the difference between four and one is three, three and a square of two plus four in

a square of two each it will be nine plus sixteen which is a total of twenty five.

And the final result is the square root of twenty five, which is a total of five.

But basically that's how you find the distance between given two numbers.

Let's go like one, two, three and Helios three and six.

So this will be the next distance between these given two points and so on.

You may also use different values, different numbers to calculate any distance, probably if you are

using it in math classes in college or something like that, feel free to write half programs that may

calculate the results for you.

OK, of course you may do it using some calculator, but since you're a programmer and a future developer,

I think that it will be a good practice for you to give it a shot in C programming.

So thank you guys for watching.

My name is Vlad Netsky.

This is Alphatech and.

I think we covered a lot, really a lot of exercises, so do me a favor, leave some review, hopefully

it will be good.

If not, let me know what should be improved for our next videos and until next time.

Have a great day and keep on positive vibes.

I'll see you then.

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