All language subtitles for 11. Static Array of Structs

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
hu Hungarian Download
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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,800 --> 00:00:01,910 What is going on, guys? 2 00:00:01,940 --> 00:00:04,130 I hope you are doing great. 3 00:00:04,280 --> 00:00:11,570 Any of these video what we are going to talk about is basically how we can work with static arrays and 4 00:00:11,840 --> 00:00:14,030 making sure make sure the camera is OK. 5 00:00:14,660 --> 00:00:15,950 Yeah, I think it is. 6 00:00:16,580 --> 00:00:26,420 And so we are going to work with static arrays of different structures and in this case, particularly 7 00:00:26,720 --> 00:00:28,940 with a point struct. 8 00:00:29,330 --> 00:00:29,690 OK. 9 00:00:30,140 --> 00:00:37,060 So what we are going to do, first of all, we know that we can create some standard variable, right? 10 00:00:37,090 --> 00:00:38,180 There is no problem. 11 00:00:38,970 --> 00:00:42,410 We we know how we can write down point b one. 12 00:00:42,680 --> 00:00:47,600 And that's how we create a point variable that is called P1. 13 00:00:48,620 --> 00:00:54,320 But there may be times just like we've done it within the juris right that there was Int Nam, but we 14 00:00:54,320 --> 00:01:02,150 wanted to create an array of integers or an array of floating point numbers, an array of characters. 15 00:01:03,230 --> 00:01:13,910 Similarly, we can do the same pretty much by creating a static array of the user, a defined structure 16 00:01:13,910 --> 00:01:14,900 that we've created. 17 00:01:15,940 --> 00:01:24,310 So in this case, we have created a point structure with the two fields in Ekes and in white oak and 18 00:01:24,310 --> 00:01:28,150 the name of the structure, the name, if we want to create at this point. 19 00:01:28,990 --> 00:01:36,010 So whenever we will use point, it will specify the type of the integer that we wanted to create. 20 00:01:36,310 --> 00:01:40,930 But now we want to see how we can create an array of points. 21 00:01:41,350 --> 00:01:47,500 So in this line 37, we create a static array of points with a size of five. 22 00:01:48,130 --> 00:01:53,770 So if we will take a look behind the scenes, how it will look like, it will be something like that. 23 00:01:54,040 --> 00:01:54,430 OK. 24 00:01:54,490 --> 00:01:56,260 So let me try it for you. 25 00:01:56,740 --> 00:02:00,970 So one, two, three four. 26 00:02:00,970 --> 00:02:02,590 And let's add the fifth one. 27 00:02:03,910 --> 00:02:04,400 OK. 28 00:02:04,720 --> 00:02:10,000 So zero, one, two, three and four. 29 00:02:11,320 --> 00:02:13,570 These will be the point. 30 00:02:15,430 --> 00:02:16,390 Points array. 31 00:02:17,130 --> 00:02:17,470 OK. 32 00:02:17,500 --> 00:02:18,400 Of size five. 33 00:02:19,540 --> 00:02:27,520 And now what I want you to take a look is that understand that each of these elements is now basically 34 00:02:27,520 --> 00:02:32,020 representing a variable of type point. 35 00:02:32,320 --> 00:02:39,760 So that means that here will be the X value and here will be the Y value, and the same will go for 36 00:02:40,060 --> 00:02:45,370 each and any of the elements inside of this array. 37 00:02:45,460 --> 00:02:45,940 OK. 38 00:02:46,420 --> 00:02:51,670 So each of the elements that can be accessed by using the index. 39 00:02:51,760 --> 00:02:52,070 OK. 40 00:02:52,090 --> 00:02:55,450 These are the indexes index. 41 00:02:56,260 --> 00:03:01,430 Each of these elements is going to have two members X and Y. 42 00:03:02,110 --> 00:03:04,300 And why do we have just two members? 43 00:03:04,690 --> 00:03:11,380 Because that's the type that we've created, and based on this type, we have only two members. 44 00:03:12,130 --> 00:03:21,130 If there were additional types or basically another struct, so the members there war basically referred 45 00:03:21,130 --> 00:03:23,590 to or related to the structure itself. 46 00:03:24,890 --> 00:03:25,310 OK. 47 00:03:26,750 --> 00:03:34,220 So we have an array of points called Points Array, its size is five, and we can access each and any 48 00:03:34,220 --> 00:03:35,420 one of its elements. 49 00:03:36,530 --> 00:03:39,280 So let's try to basically just access. 50 00:03:39,290 --> 00:03:41,510 Let me get another color. 51 00:03:41,780 --> 00:03:49,520 Let's try to access just this element into store inside of the field x some value on inside of the field 52 00:03:49,520 --> 00:03:51,110 of white and other value. 53 00:03:51,890 --> 00:03:53,750 So how basically should you do it? 54 00:03:54,800 --> 00:04:02,750 You should print some message to the user saying, please enter a first X coordinate and then what you 55 00:04:02,750 --> 00:04:10,610 are going to do is simply to read this information and store it inside some variable, right? 56 00:04:11,420 --> 00:04:20,360 So the main step here is to understand the structure of accessing a certain element in the array and 57 00:04:20,360 --> 00:04:24,500 then accessing a certain field inside of this certain element. 58 00:04:24,950 --> 00:04:30,500 OK, so first of all, what we will do is we will say that Point's array is just the name of the array 59 00:04:30,860 --> 00:04:35,000 and it will help us to access different fields inside of it. 60 00:04:35,780 --> 00:04:38,060 So points array at index zero. 61 00:04:38,300 --> 00:04:40,250 All he does is returning. 62 00:04:40,250 --> 00:04:42,170 You kind of this block. 63 00:04:42,980 --> 00:04:43,490 OK. 64 00:04:43,910 --> 00:04:45,710 And what is the type of these block? 65 00:04:46,710 --> 00:04:48,360 It's types of a point. 66 00:04:48,600 --> 00:04:49,020 Right? 67 00:04:49,500 --> 00:04:54,600 It's a point because these these in array of points, five elements of point type. 68 00:04:55,470 --> 00:05:03,240 And we know that each element has the following members index and entwine since it's a point so we can 69 00:05:03,240 --> 00:05:06,000 use the DOT to access the X field. 70 00:05:07,130 --> 00:05:14,000 So once we use the DOT, what we specify is that we are currently looking at. 71 00:05:14,360 --> 00:05:19,940 Come on at this region at these variable X. 72 00:05:20,870 --> 00:05:21,210 OK. 73 00:05:21,260 --> 00:05:28,940 After points array, it's index zero gave us all of this and data X gives us this specific X right here. 74 00:05:30,230 --> 00:05:34,580 And then, of course, because that's the syntax of this kind of function. 75 00:05:34,880 --> 00:05:39,800 We use the ampersand to specify store it inside the address of fix. 76 00:05:41,160 --> 00:05:48,180 And then we put some value here, let's say three, and then we repeat this process and do pretty much 77 00:05:48,180 --> 00:05:57,510 the same by accessing and storing the information inside of the Y member at Points Array at Index zero. 78 00:05:57,510 --> 00:05:59,340 So we store here five. 79 00:06:00,940 --> 00:06:01,540 OK. 80 00:06:02,320 --> 00:06:08,920 That's it, that's all that we do, X and Y storing it three and five. 81 00:06:10,550 --> 00:06:18,230 OK, so let's basically run this program and make sure that so far it works exactly as we expect. 82 00:06:19,310 --> 00:06:27,410 For now, let's simply comments out this blog, because that's the next part of what's come again. 83 00:06:27,440 --> 00:06:28,930 No, no, no. 84 00:06:29,690 --> 00:06:32,180 That's the next part of our editorial. 85 00:06:33,460 --> 00:06:36,310 Now, let's run it and hope for the best. 86 00:06:36,910 --> 00:06:38,830 OK, so there you go. 87 00:06:39,340 --> 00:06:40,750 We don't need the here. 88 00:06:40,780 --> 00:06:41,350 Come on. 89 00:06:42,420 --> 00:06:43,260 Let's run it. 90 00:06:43,980 --> 00:06:44,970 Let's run it. 91 00:06:46,810 --> 00:06:47,590 What's going on? 92 00:06:48,310 --> 00:06:52,870 OK, so and there a first point x coordinate, let's say, three. 93 00:06:53,820 --> 00:07:02,850 That's point also will say that let's use five and basically now we cannot see it right now, but basically 94 00:07:02,850 --> 00:07:09,090 behind the scenes, all that happened is we simply storing the value we specified in this box and the 95 00:07:09,090 --> 00:07:11,430 value was specified in these white. 96 00:07:12,090 --> 00:07:12,570 That's it. 97 00:07:13,780 --> 00:07:15,460 OK, so far, so good. 98 00:07:16,520 --> 00:07:26,150 Awesome, so we can move on to the next part, and this next part is basically referred to understanding 99 00:07:26,150 --> 00:07:28,640 that we know how to access. 100 00:07:29,060 --> 00:07:34,460 We know how to access a specific element inside of this array. 101 00:07:34,940 --> 00:07:42,830 And now what we are going to do is to iterate over all of the point array and reading input into each 102 00:07:42,830 --> 00:07:43,370 of them. 103 00:07:43,580 --> 00:07:48,350 OK, and getting, let's say, getting getting input into each of them. 104 00:07:49,130 --> 00:07:52,670 So we'll use a simple and standard for loop. 105 00:07:53,300 --> 00:08:00,410 We will use for our equals to zero as long as I is less than five C++, meaning five iterations on every 106 00:08:00,410 --> 00:08:01,010 iteration. 107 00:08:01,010 --> 00:08:07,930 We are going to ask the user, please answer some point, OK, which point point I'm just using here? 108 00:08:07,940 --> 00:08:13,370 These are sine and percent that will be replaced with the value of eight plus one. 109 00:08:14,120 --> 00:08:20,630 And the reason why I'm using here I +1 is because I want to ask the user entry point one entry point 110 00:08:20,630 --> 00:08:27,890 two and not to start with entry point zero because the first element of I is going to be zero in the 111 00:08:27,890 --> 00:08:28,730 first iteration. 112 00:08:28,730 --> 00:08:29,600 That's not what I want. 113 00:08:29,600 --> 00:08:36,680 I want to make it, not by the values of the indexes, but rather by some more standard values from 114 00:08:36,680 --> 00:08:37,520 one up to five. 115 00:08:39,040 --> 00:08:44,590 And then what we are going to do is to access a specific element inside of this array. 116 00:08:45,630 --> 00:08:48,360 Which depends on the high index. 117 00:08:49,500 --> 00:08:49,920 OK. 118 00:08:50,520 --> 00:08:58,950 And once we access a specific element, we will be able to access a specific member inside of this element. 119 00:08:59,790 --> 00:09:06,280 OK, so we know that Point's array, its index site, is of a point type and we can access. 120 00:09:06,300 --> 00:09:11,180 We know that a poison type is defined by two fields in these example intakes and in Y. 121 00:09:11,490 --> 00:09:18,180 And we can access each of these fields and then to use the jumper to specify that we want to store inside 122 00:09:18,180 --> 00:09:21,390 of these address of the specific member. 123 00:09:23,740 --> 00:09:32,050 So all of these function is going to do is just to read from the user five X values and five Y values 124 00:09:32,050 --> 00:09:35,110 and store them accordingly inside of these points of rate. 125 00:09:36,850 --> 00:09:37,350 OK. 126 00:09:38,410 --> 00:09:44,230 And once we stored all of this information, OK, and by the way, once again, it doesn't have to be 127 00:09:44,230 --> 00:09:47,950 just in the jurors, it can be a float, it can be a double and can be a char. 128 00:09:48,280 --> 00:09:50,230 There is nothing, nothing about it. 129 00:09:50,230 --> 00:09:53,350 I'm just using a simple example to make the whole. 130 00:09:54,320 --> 00:09:59,570 Process of thinking and learning these concepts to be as much easier as possible. 131 00:09:59,750 --> 00:10:03,650 OK, so if we used here is something else. 132 00:10:03,710 --> 00:10:05,390 So for example, we used, I don't know. 133 00:10:08,050 --> 00:10:14,130 Some float, so instead of percentage, they simply use percentage and for percentage allow for a percentage 134 00:10:14,140 --> 00:10:17,560 see based on the phenotype that you are working with. 135 00:10:18,060 --> 00:10:19,660 OK, nothing so difficult. 136 00:10:20,800 --> 00:10:21,250 Awesome. 137 00:10:21,260 --> 00:10:24,130 So after this point, we have our whole array. 138 00:10:24,610 --> 00:10:27,490 These guy right here are filled with values. 139 00:10:28,770 --> 00:10:29,760 So we can move on. 140 00:10:30,990 --> 00:10:40,170 And we can access and print all of these values basically one by one, and we can access and print the 141 00:10:40,170 --> 00:10:43,680 values of each of the static array of points. 142 00:10:44,670 --> 00:10:45,660 And how should we do it? 143 00:10:46,140 --> 00:10:49,350 Once again, we need to iterate over all the elements. 144 00:10:49,380 --> 00:10:51,060 There are five in this example. 145 00:10:51,060 --> 00:10:54,090 We need to iterate over all the elements of this array. 146 00:10:55,090 --> 00:11:01,630 And accessing each of the elements and inside of the each of the elements, we need to access each of 147 00:11:01,630 --> 00:11:04,930 the members inside of these element in these gates. 148 00:11:05,170 --> 00:11:13,030 The point elements so point percentage, the first point we will use here plus one, just like previously 149 00:11:13,040 --> 00:11:19,360 explained, equals in higher percentage will be replaced by points or at index. 150 00:11:19,360 --> 00:11:28,210 I don't x and by points a rating distinct Y grades simply accessing the members of a certain element 151 00:11:28,210 --> 00:11:28,930 in disarray. 152 00:11:29,680 --> 00:11:34,480 And the reason why we don't want why we do not use ampersand here as opposed to scan. 153 00:11:34,480 --> 00:11:40,030 If it's because we want to print the value of the the variable itself, right? 154 00:11:40,030 --> 00:11:42,990 We don't want to print basically the address. 155 00:11:43,000 --> 00:11:46,150 We are not interested in this point, at least. 156 00:11:46,930 --> 00:11:54,240 OK, so let's simply comment these marked out and let's run and hope for the best. 157 00:11:54,250 --> 00:11:55,240 Let's see what happens. 158 00:11:55,900 --> 00:11:58,180 So enter point one x coordinate. 159 00:11:58,180 --> 00:11:59,230 Let's use one. 160 00:11:59,920 --> 00:12:00,520 What happened? 161 00:12:01,810 --> 00:12:03,580 I pressed something wrong. 162 00:12:03,970 --> 00:12:06,820 OK, so let's try it once again, sir. 163 00:12:06,840 --> 00:12:07,330 One. 164 00:12:07,810 --> 00:12:10,810 And let's use and 3.1. 165 00:12:11,560 --> 00:12:12,040 OK. 166 00:12:12,400 --> 00:12:16,030 X and Y inside of the first point are going to be one and one. 167 00:12:16,450 --> 00:12:21,340 In the second point, they are going to be two and three in the third point. 168 00:12:21,460 --> 00:12:27,490 They are going to be one in five in the fourth, let's say, five and five and nine and nine. 169 00:12:28,300 --> 00:12:36,250 And finally, we can see that point number one equals two one one one one point two two to three point 170 00:12:36,250 --> 00:12:41,740 three to one five point four to five five and point five to nine nine. 171 00:12:42,860 --> 00:12:51,080 So what it means is basically this whole array is store and is probably a sequence of bytes in memory. 172 00:12:51,620 --> 00:12:51,970 OK? 173 00:12:52,010 --> 00:13:01,430 A sequence of bytes and each element is also kind of a sequence because it's by self destruct. 174 00:13:01,430 --> 00:13:05,280 So there are going to be like in this example, let's say, in the jury's four bytes. 175 00:13:05,280 --> 00:13:08,900 So there are going to be four bytes for X, four bytes for why? 176 00:13:09,050 --> 00:13:11,150 And that's basically the first element. 177 00:13:11,390 --> 00:13:17,270 And then there are going to be four bytes for X, four bytes for Y and so on, and for the second element 178 00:13:17,270 --> 00:13:18,290 and so on and so forth. 179 00:13:18,290 --> 00:13:21,020 You move on with the array itself. 180 00:13:22,080 --> 00:13:22,590 OK. 181 00:13:23,970 --> 00:13:24,450 Who? 182 00:13:24,960 --> 00:13:33,060 So I hope this is clear so far and that everything that I explain to you is getting more and more clearer. 183 00:13:33,360 --> 00:13:37,430 It's uncomment everything that's basically the program that we've created. 184 00:13:37,440 --> 00:13:41,130 Now we have created, you know, a structure point. 185 00:13:41,460 --> 00:13:43,650 We created a static array of points. 186 00:13:44,190 --> 00:13:48,420 Very similar to how we created an array of integers in a way to float. 187 00:13:49,080 --> 00:13:58,950 We also created, we've shown we've seen how we can access a specific member in a specific element in 188 00:13:58,950 --> 00:14:08,550 the array, how we can scan F and write the information into it while it's used instead of reading was 189 00:14:08,580 --> 00:14:09,300 writing. 190 00:14:11,210 --> 00:14:18,410 And then we've seen how we can iterate over all the elements, read inputs, right inputs into each 191 00:14:18,410 --> 00:14:22,700 of them, and then to access and print all the values inside of these elements. 192 00:14:23,840 --> 00:14:25,610 So yeah, this is it. 193 00:14:25,640 --> 00:14:26,750 Thank you guys for watching. 194 00:14:26,780 --> 00:14:28,130 Keep on practicing. 195 00:14:28,160 --> 00:14:31,610 Keep on moving forward and you are bound to succeed. 196 00:14:32,270 --> 00:14:35,300 Let me know if you like this video and the material so far. 197 00:14:35,360 --> 00:14:39,950 Please also feel free to leave some reviews, some feedback, some star rating. 198 00:14:39,950 --> 00:14:45,380 It helps me a lot in improving the course material that it will be more optimized for you. 199 00:14:46,190 --> 00:14:46,730 Thank you. 200 00:14:46,880 --> 00:14:49,130 And until the next video, I'll see you then. 201 00:14:49,310 --> 00:14:49,640 Bye. 18601

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