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

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,540 --> 00:00:04,990 So let's find the distance between two given points. 2 00:00:05,010 --> 00:00:08,300 So first of all, we have this first point. 3 00:00:08,310 --> 00:00:12,120 So it was something like this one y one. 4 00:00:12,480 --> 00:00:17,520 And we have another point, which is the X2 and Y two. 5 00:00:18,000 --> 00:00:18,870 OK, awesome. 6 00:00:19,230 --> 00:00:25,050 So what we have to do is to apply some formulas and rule that we found out previously and it goes like 7 00:00:25,050 --> 00:00:25,310 this. 8 00:00:25,680 --> 00:00:30,750 So the distance between two points equals to square root. 9 00:00:30,750 --> 00:00:40,770 So security of X one, OK, X one minus X to all of that in the power of two plus right. 10 00:00:41,580 --> 00:00:46,920 Y one minus Y two and a square root. 11 00:00:47,430 --> 00:00:54,000 And all of this going to be under this square root in, in the power of two. 12 00:00:54,210 --> 00:00:58,500 OK, and all of the result is going to be applied a square root. 13 00:00:58,510 --> 00:01:05,390 So let's first of all, just create all of these values. 14 00:01:05,400 --> 00:01:07,440 So let's go with a floating point type. 15 00:01:07,440 --> 00:01:08,070 So shall we. 16 00:01:08,340 --> 00:01:13,890 So float X one Y one X to Y to OK. 17 00:01:14,160 --> 00:01:17,730 And now we'll simply read the values from the user. 18 00:01:17,760 --> 00:01:21,530 So there are a couple of approaches to read all of these values. 19 00:01:21,930 --> 00:01:24,300 Let's use the most obvious one. 20 00:01:24,420 --> 00:01:29,640 OK, so just print F, answer X one, OK? 21 00:01:29,640 --> 00:01:37,740 And then read it using this kind of function percentage F and store it inside of variable X one and 22 00:01:38,610 --> 00:01:47,630 now simply copy these two lines over and over again for all of our variables. 23 00:01:47,640 --> 00:01:51,670 So X one it will be x2 or maybe let's use here. 24 00:01:51,700 --> 00:02:04,220 Now this is one Y one Y one a X two weeks to Y to and here also Y two. 25 00:02:04,620 --> 00:02:09,450 OK, so we are going to read X one, Y one x2 and Y two. 26 00:02:10,140 --> 00:02:16,200 And once we are done reading this information, there are also a couple of approaches. 27 00:02:16,200 --> 00:02:23,940 But what we are going to do now is to simply just include in your library that contains a lot of mathematical 28 00:02:23,940 --> 00:02:24,800 operations. 29 00:02:25,170 --> 00:02:31,290 So we are going to use here include math dot h. 30 00:02:31,380 --> 00:02:31,710 Right. 31 00:02:31,720 --> 00:02:39,360 We said previously that we are including in most of our programs in this course, the standard input 32 00:02:39,360 --> 00:02:40,420 output library. 33 00:02:40,500 --> 00:02:46,290 OK, yesterday we will talk about it, but I'm not sure that it will be in these course in the more 34 00:02:46,290 --> 00:02:47,100 advanced course. 35 00:02:47,580 --> 00:02:56,070 But basically the audio is the standard of the input output which contains and functions such as print 36 00:02:56,070 --> 00:02:57,660 F and scan F and so on. 37 00:02:57,960 --> 00:03:02,520 Some functions that refer to input and output operations. 38 00:03:03,540 --> 00:03:10,500 And now what we have to do is simply to print the distance, so let's create additional variable, let's 39 00:03:10,500 --> 00:03:19,530 call this variable Flude distance and distance will be equal to distance will be equal to what distance 40 00:03:19,530 --> 00:03:23,940 will be equal to ask you r t you can see that this function. 41 00:03:24,030 --> 00:03:25,830 OK, this is kind of function. 42 00:03:25,830 --> 00:03:31,410 It applies a square root on a given number inside of these parentheses. 43 00:03:31,440 --> 00:03:34,660 So that's something that the math that H gives us. 44 00:03:34,980 --> 00:03:42,870 So security in here, we will specify, let's say that we even do not know exactly what is the specification 45 00:03:42,870 --> 00:03:48,380 of taking some value and applying the power of two on it. 46 00:03:48,690 --> 00:03:56,100 So we will simply go like this x1 minus x2 multiplied by the same x1 minus six to write. 47 00:03:56,370 --> 00:03:59,370 The result will be the same as the power of two. 48 00:03:59,730 --> 00:04:11,380 And we take all of that and simply added like y one minus Y two multiplied by Y one minus one Y two. 49 00:04:11,940 --> 00:04:17,010 So that's basically the formula for finding the distance in this case. 50 00:04:17,220 --> 00:04:18,930 So that's how you find the distance. 51 00:04:19,290 --> 00:04:26,780 The is a mathematical operation that exists in this math that H library. 52 00:04:27,330 --> 00:04:28,780 So that's awesome. 53 00:04:29,010 --> 00:04:33,840 And now all that remains to do is to print the result to the screen. 54 00:04:34,650 --> 00:04:42,990 So simply take the following print of command and the distance, the distance between the points. 55 00:04:43,170 --> 00:04:50,100 OK, so let's say between the points here, let's use a very descriptive message, percentage F percentage, 56 00:04:50,100 --> 00:04:56,130 if it's just limited to be like point two and point two. 57 00:04:56,670 --> 00:04:56,950 OK. 58 00:04:56,970 --> 00:04:59,850 So the distance between the points. 59 00:04:59,940 --> 00:05:06,750 OK, that's the first point and the second point, which is also going to be represented like this. 60 00:05:06,900 --> 00:05:13,920 OK, so percentage point to F so that's the distance. 61 00:05:13,920 --> 00:05:20,520 That's the point is and now we are going to specify the distance itself, which is also going to be 62 00:05:20,520 --> 00:05:21,860 of a floating point type. 63 00:05:22,200 --> 00:05:24,590 So that's how it should be done. 64 00:05:25,020 --> 00:05:29,790 And now here we are going to specify the exact values. 65 00:05:30,060 --> 00:05:39,100 So for the first percentage, if it's X one and the second one is Y one, x two, white two. 66 00:05:39,120 --> 00:05:41,520 OK, so we covered both of these points. 67 00:05:41,940 --> 00:05:47,910 And finally, we have also to specify the distance, which is distance. 68 00:05:47,940 --> 00:05:55,800 OK, so we found laid out here, we calculated it on line twenty seven, use a semicolon at the end 69 00:05:55,800 --> 00:05:59,630 and basically I think that we are ready to build and run it. 70 00:06:00,480 --> 00:06:05,360 So let's go build and run and we have a problem here. 71 00:06:05,370 --> 00:06:07,340 OK, we forgot these parentheses. 72 00:06:07,350 --> 00:06:07,750 OK. 73 00:06:07,770 --> 00:06:08,850 So yeah. 74 00:06:09,210 --> 00:06:11,790 So build and run and so enter x1. 75 00:06:12,620 --> 00:06:13,590 Let's make it. 76 00:06:14,040 --> 00:06:23,880 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 77 00:06:23,940 --> 00:06:33,940 three and now let's use here x2 is four and this one is seven for example. 78 00:06:33,960 --> 00:06:43,620 OK, so we will get here that both of the points are one in three, four and seven and the distance 79 00:06:43,620 --> 00:06:50,820 is fine because the difference between four and one is three, three and a square of two plus four in 80 00:06:50,820 --> 00:06:56,760 a square of two each it will be nine plus sixteen which is a total of twenty five. 81 00:06:57,030 --> 00:07:01,800 And the final result is the square root of twenty five, which is a total of five. 82 00:07:02,220 --> 00:07:06,600 But basically that's how you find the distance between given two numbers. 83 00:07:06,600 --> 00:07:11,010 Let's go like one, two, three and Helios three and six. 84 00:07:11,310 --> 00:07:15,840 So this will be the next distance between these given two points and so on. 85 00:07:15,870 --> 00:07:24,360 You may also use different values, different numbers to calculate any distance, probably if you are 86 00:07:24,360 --> 00:07:31,290 using it in math classes in college or something like that, feel free to write half programs that may 87 00:07:31,290 --> 00:07:33,000 calculate the results for you. 88 00:07:33,090 --> 00:07:40,890 OK, of course you may do it using some calculator, but since you're a programmer and a future developer, 89 00:07:42,270 --> 00:07:48,450 I think that it will be a good practice for you to give it a shot in C programming. 90 00:07:49,050 --> 00:07:50,890 So thank you guys for watching. 91 00:07:50,910 --> 00:07:52,320 My name is Vlad Netsky. 92 00:07:52,470 --> 00:07:54,510 This is Alphatech and. 93 00:07:55,370 --> 00:08:03,360 I think we covered a lot, really a lot of exercises, so do me a favor, leave some review, hopefully 94 00:08:03,360 --> 00:08:04,220 it will be good. 95 00:08:04,220 --> 00:08:09,480 If not, let me know what should be improved for our next videos and until next time. 96 00:08:09,680 --> 00:08:13,430 Have a great day and keep on positive vibes. 97 00:08:13,670 --> 00:08:14,410 I'll see you then. 9454

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