All language subtitles for 10. Exercise - Input Point & Print Point - 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,840 --> 00:00:07,170 All right, so now that you tried to solve this exercise on your own, you gave it your best. 2 00:00:07,380 --> 00:00:11,040 You rode the down the structure, you rode down the functions. 3 00:00:11,580 --> 00:00:14,790 Let us try to take a look at it together. 4 00:00:15,060 --> 00:00:20,760 OK, so first of all, what we are going to do is taking a look at the printing function. 5 00:00:20,880 --> 00:00:25,740 The first function that gets a point variable and printing information. 6 00:00:27,120 --> 00:00:34,470 So first of all, we created the structure of the point that's, you know, how to do it than what we've 7 00:00:34,470 --> 00:00:40,110 done is basically we thought about the function is going to get a point and he's going to print this 8 00:00:40,110 --> 00:00:40,800 information. 9 00:00:41,520 --> 00:00:50,250 So probably this operation is related to the fact that we are going to print and we are going to use 10 00:00:50,250 --> 00:00:52,290 the printing operation for points. 11 00:00:53,160 --> 00:00:57,060 OK, so let's give this function a proper name and call this function. 12 00:00:57,060 --> 00:00:59,280 Print point makes sense, right? 13 00:00:59,670 --> 00:01:00,900 OK, very important. 14 00:01:01,290 --> 00:01:05,100 Not a func not void, func void print point. 15 00:01:05,430 --> 00:01:09,570 We know that what this function does just by taking a look at its name. 16 00:01:11,170 --> 00:01:16,950 In these function, he's going to get it's going to get a point variable. 17 00:01:18,520 --> 00:01:19,120 Here it is. 18 00:01:19,960 --> 00:01:25,940 That's a point variable, be one we could name it any other name, OK? 19 00:01:25,960 --> 00:01:28,690 Here, it really doesn't so much matter, OK? 20 00:01:28,710 --> 00:01:33,670 We can also use some more descriptive name for a point variable, but b one. 21 00:01:33,670 --> 00:01:38,770 I think that it's pretty understandable, OK, whenever we take, when we talk about points. 22 00:01:40,620 --> 00:01:41,640 Now about. 23 00:01:42,930 --> 00:01:46,320 The type of the function, why did we leave it as void? 24 00:01:47,010 --> 00:01:54,360 Well, that's pretty obvious because if we take a look at the definition and it what we were required 25 00:01:54,390 --> 00:02:00,990 to do, we were required to write two functions function, one to get a point variable and then print 26 00:02:01,000 --> 00:02:01,880 out information. 27 00:02:02,880 --> 00:02:03,300 So. 28 00:02:04,300 --> 00:02:07,000 These functions should not return anything. 29 00:02:07,450 --> 00:02:12,070 You can see that there is no word of return there we print. 30 00:02:12,190 --> 00:02:12,940 Yeah, print. 31 00:02:13,210 --> 00:02:18,580 But you know that there is a difference between printing and returning. 32 00:02:19,000 --> 00:02:23,020 So print is used to print the information to the screen. 33 00:02:24,090 --> 00:02:24,600 OK. 34 00:02:25,080 --> 00:02:25,740 And. 35 00:02:26,810 --> 00:02:32,720 You know, that return is basically used between different functions, right, whenever you call a function. 36 00:02:32,990 --> 00:02:36,390 So these function returns to whoever called this function. 37 00:02:36,410 --> 00:02:38,570 So there is a difference between print and return. 38 00:02:38,990 --> 00:02:45,020 And since this function does not, print does not return anything and it's only print and it only prints, 39 00:02:45,840 --> 00:02:48,050 then we can say that it should be of avoid Typekit. 40 00:02:48,980 --> 00:02:49,970 Now what should he do? 41 00:02:50,330 --> 00:02:55,230 Basically, it should execute two lines, two very basic lines. 42 00:02:55,250 --> 00:03:05,150 The first one is print point X equals two percentage D. Simply printing out the basis the basic information 43 00:03:05,150 --> 00:03:08,030 about the X and Y coordinates. 44 00:03:09,470 --> 00:03:10,430 So far, so good. 45 00:03:11,330 --> 00:03:11,780 Awesome. 46 00:03:12,650 --> 00:03:13,040 So. 47 00:03:14,040 --> 00:03:14,640 That's right. 48 00:03:14,940 --> 00:03:18,000 That's a that's function number one done. 49 00:03:18,960 --> 00:03:25,650 Now we are going to talk about function number two, which should be responsible for getting a input 50 00:03:25,650 --> 00:03:27,390 from the user and then return it. 51 00:03:28,500 --> 00:03:33,660 So we will call these function input point and all these function is going to do. 52 00:03:33,690 --> 00:03:35,740 It's going to create a new point. 53 00:03:35,940 --> 00:03:37,170 Let's call it my point. 54 00:03:37,830 --> 00:03:40,890 So first of all, we create a variable of the structure, a point. 55 00:03:42,090 --> 00:03:43,020 Then what do we do? 56 00:03:43,380 --> 00:03:47,340 We ask the user, Please enter x coordinate. 57 00:03:47,820 --> 00:03:52,320 Read this information from the user and store it inside my point got x. 58 00:03:52,750 --> 00:03:54,780 Then we print again. 59 00:03:54,780 --> 00:03:55,950 Enter Y coordinates. 60 00:03:55,950 --> 00:04:02,970 Read the Y coordinate and store both of these values X and Y under my point variable. 61 00:04:03,420 --> 00:04:04,140 That's what we do. 62 00:04:05,160 --> 00:04:13,170 And the final step is we want to return this point that we got all the information about it from the 63 00:04:13,170 --> 00:04:13,620 user. 64 00:04:14,860 --> 00:04:22,190 And the way we do it is simply by specifying the key word return and then the name of the variable. 65 00:04:22,960 --> 00:04:25,060 And what is the type of this variable? 66 00:04:25,580 --> 00:04:29,020 That type of these variable is a point type, right? 67 00:04:29,020 --> 00:04:32,140 Because if we take a look at it, we can see when we created it. 68 00:04:32,470 --> 00:04:35,790 We also specified that it should be of a point type. 69 00:04:36,670 --> 00:04:43,630 So that type of the function is also going to be point since we return a variable of a point type. 70 00:04:44,170 --> 00:04:46,540 Remember this thing right here? 71 00:04:46,540 --> 00:04:50,170 It specifies the type of the return value from a function. 72 00:04:51,080 --> 00:04:51,440 OK. 73 00:04:53,220 --> 00:05:00,090 So if you have a written here and double char, please try to think about it once again. 74 00:05:01,350 --> 00:05:10,830 So now that we have both of our functions, Greenpoint and Input Point, we can move on to see how we 75 00:05:10,830 --> 00:05:14,160 can call them and make some usage out of them. 76 00:05:14,640 --> 00:05:18,690 And so our program will run more smoothly. 77 00:05:20,280 --> 00:05:22,140 So let's take a look at it. 78 00:05:22,680 --> 00:05:23,820 So there is point B. 79 00:05:23,820 --> 00:05:25,440 One equals two input point. 80 00:05:26,620 --> 00:05:27,850 So what happens here? 81 00:05:28,510 --> 00:05:36,340 Basically, when we try to create one, we call this input point function and all of these function 82 00:05:36,340 --> 00:05:44,530 does is basically taking a responsibility for running these intrigues coordinated and their white coordinate 83 00:05:44,530 --> 00:05:47,680 and asking the user for a data to fill up this point. 84 00:05:47,950 --> 00:05:53,770 And then it returns us kind of complete point that we can use for the next of the program. 85 00:05:54,250 --> 00:05:57,370 Then we print P1 one before it changes. 86 00:05:57,610 --> 00:06:00,340 We print this value how we can print P1. 87 00:06:00,700 --> 00:06:05,240 We could also run here and basically write something like that. 88 00:06:05,240 --> 00:06:07,990 So print half print the X and Y coordinates. 89 00:06:08,380 --> 00:06:13,330 But we know that there is a function, a specific function that we've created for this task. 90 00:06:14,140 --> 00:06:14,710 Here it is. 91 00:06:14,710 --> 00:06:20,500 Print point and print point can be called on P1 because it receives a point. 92 00:06:21,480 --> 00:06:21,850 OK. 93 00:06:22,290 --> 00:06:28,530 And all it's going to do is just to print the X and Y coordinates that you received from the user inside 94 00:06:28,530 --> 00:06:30,150 of these function input point. 95 00:06:31,840 --> 00:06:39,580 Right afterwards, we are going to completely modify the X and Y coordinates inside of B one, the score 96 00:06:39,580 --> 00:06:44,920 of the night, we're going to increase by one to incremented and the Y by three. 97 00:06:45,010 --> 00:06:46,420 OK, incremented by three. 98 00:06:47,440 --> 00:06:55,090 And then we are going to call this function pinpoint once again and see if something has changed. 99 00:06:55,600 --> 00:06:58,030 OK, so kind of elegant program, right? 100 00:06:58,270 --> 00:07:02,470 Although we are using a lot of interruptions in a lot of printing with the user. 101 00:07:04,210 --> 00:07:11,440 So now let us run this program and hope for the best that it will work exactly as we expect. 102 00:07:11,540 --> 00:07:13,450 So answer excoriating it. 103 00:07:13,570 --> 00:07:14,350 Let's make it. 104 00:07:14,500 --> 00:07:15,880 I don't know, Tim. 105 00:07:17,320 --> 00:07:18,280 Come on, Tim. 106 00:07:19,180 --> 00:07:20,540 Answer why coordinate? 107 00:07:20,560 --> 00:07:21,880 Let's make it 15. 108 00:07:22,990 --> 00:07:31,720 So be one before it changes was point X equals two, ten point Y equals 215 and B one after the changes 109 00:07:31,720 --> 00:07:39,400 equals two point two x equals to eleven because we incremented it by one and point Y equals to 18 since 110 00:07:39,400 --> 00:07:40,960 we incremented it by three. 111 00:07:41,890 --> 00:07:43,690 So yeah, this is it, guys. 112 00:07:43,690 --> 00:07:50,620 For these video of solutions, we have created a struct we've written two points are two functions that 113 00:07:50,620 --> 00:07:54,700 are probably going to be used a lot. 114 00:07:54,880 --> 00:08:03,460 If you are developing a program to work with points, you are most likely going to need to get the X 115 00:08:03,460 --> 00:08:05,020 and Y coordinates from the user. 116 00:08:05,020 --> 00:08:10,590 For that, you have the input point and also you're probably going to print the point to the screen. 117 00:08:10,690 --> 00:08:12,190 So for that, you have this one. 118 00:08:12,400 --> 00:08:16,270 You can also write down some implementation of your own using some. 119 00:08:17,170 --> 00:08:23,890 Using some parentheses instead of printing out Point X equals to something and point Y equals to something 120 00:08:23,890 --> 00:08:29,080 you can use like point coordinates in parentheses and just percentage a percentage. 121 00:08:29,590 --> 00:08:30,040 That's it. 122 00:08:30,430 --> 00:08:30,820 OK. 123 00:08:31,390 --> 00:08:35,870 And here inside of the main function, we've made a couple of function calls. 124 00:08:35,890 --> 00:08:37,030 We call this function. 125 00:08:37,030 --> 00:08:38,320 We know it returns a point. 126 00:08:38,680 --> 00:08:40,570 And there is a match between them. 127 00:08:40,990 --> 00:08:47,710 We also know that we can call these function print point because if it is of void type, we can call 128 00:08:47,710 --> 00:08:47,920 it. 129 00:08:49,000 --> 00:08:49,480 That's it. 130 00:08:50,890 --> 00:08:52,390 So thank you guys for watching. 131 00:08:53,020 --> 00:08:54,070 Keep on practicing. 132 00:08:54,100 --> 00:08:54,850 I'll see you then. 11970

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