All language subtitles for 4. Challenge 1 - Initialize & Print Date Variable

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,420 --> 00:00:05,460 What is going on, guys, in this video, what we are going to do is to give it a little bit of practice 2 00:00:05,760 --> 00:00:07,870 to our structure usage. 3 00:00:08,220 --> 00:00:14,550 So first of all, what I want us to do is to write a simple program that will create a structure of 4 00:00:14,550 --> 00:00:14,970 point. 5 00:00:15,000 --> 00:00:18,420 So there you go, struct the keyword struct. 6 00:00:18,420 --> 00:00:23,760 And we use the point as its name is we've seen in one of our previous videos. 7 00:00:24,060 --> 00:00:28,500 So we create a strong point structure. 8 00:00:28,530 --> 00:00:35,040 So now what we will have here is simply the fields associated with these templates. 9 00:00:35,040 --> 00:00:37,350 So intakes and Ayinde. 10 00:00:37,370 --> 00:00:38,550 Why that's it. 11 00:00:39,300 --> 00:00:41,190 So what we created here. 12 00:00:41,220 --> 00:00:46,260 OK, make sure that it does not it is not created inside of a given function. 13 00:00:46,260 --> 00:00:47,790 It is created outside. 14 00:00:48,030 --> 00:00:57,240 We simply created a bit of a structure, a template that now from this template we will be able to create 15 00:00:58,080 --> 00:01:00,280 variables of this type. 16 00:01:00,300 --> 00:01:06,070 So let's say, for example, we wanted to create a variable of a point type. 17 00:01:06,210 --> 00:01:07,770 So what should we use? 18 00:01:07,780 --> 00:01:10,560 Should we simply first of all, let's remove this print. 19 00:01:10,680 --> 00:01:11,400 Hello, world. 20 00:01:12,060 --> 00:01:14,730 Should we use something like that point? 21 00:01:15,000 --> 00:01:16,540 Let's say P1. 22 00:01:16,800 --> 00:01:18,270 OK, so point B one. 23 00:01:18,600 --> 00:01:19,610 Is that OK? 24 00:01:19,650 --> 00:01:20,640 Will it work? 25 00:01:20,850 --> 00:01:22,440 Let's try to build and run it. 26 00:01:22,470 --> 00:01:23,700 So let's build and run them. 27 00:01:23,730 --> 00:01:24,210 There you go. 28 00:01:24,220 --> 00:01:26,070 You can see here a problem. 29 00:01:26,310 --> 00:01:30,290 You can see here where it is unknown type, name, point. 30 00:01:30,330 --> 00:01:39,300 So why can't we create a point variable p one is the name point is a structure, a template. 31 00:01:39,310 --> 00:01:44,790 And the reason is very simple because if we want to create a variable, at least for now, OK, for 32 00:01:44,790 --> 00:01:51,030 now, for later, later on, we will also learn how to use the TYPEDEF in one of the future videos in 33 00:01:51,030 --> 00:01:51,660 this section. 34 00:01:52,410 --> 00:02:01,500 But for now, if we want to create a structure point variable, we need to use all of these syntax. 35 00:02:01,500 --> 00:02:05,130 So struct point, OK, struct point. 36 00:02:05,310 --> 00:02:12,510 We create, we specify the type, OK, just like you used int X and Y and Z, whatever. 37 00:02:12,900 --> 00:02:18,260 You specify the type and the type of struct point and the variable name. 38 00:02:18,540 --> 00:02:24,210 And now if you build in runni just to make sure that everything works, you will see that OK, the problem 39 00:02:24,210 --> 00:02:24,630 runs. 40 00:02:24,630 --> 00:02:28,950 Nothing happened because we didn't print anything and we didn't read anything from the user. 41 00:02:29,190 --> 00:02:35,700 But what we can make sure is that these program works and these syntax is probably OK. 42 00:02:35,910 --> 00:02:36,200 Right. 43 00:02:36,600 --> 00:02:37,220 All right. 44 00:02:37,230 --> 00:02:45,690 So also what we want to do is let's say we want to like to access these fields and to set some values 45 00:02:45,690 --> 00:02:46,290 inside of them. 46 00:02:46,410 --> 00:02:57,210 So let's use just print have enter, let's say X coordinate, OK, and also use it something like that. 47 00:02:57,450 --> 00:03:05,790 And also what we would like to use is hanser the Y coordinate and we are going to use this kind of function 48 00:03:05,790 --> 00:03:08,210 to read these values and to store them. 49 00:03:08,220 --> 00:03:11,300 Where are we going to store them inside of P1. 50 00:03:11,700 --> 00:03:14,620 Is that OK if we are going to use it this way? 51 00:03:14,640 --> 00:03:21,480 Probably not, because what we need to specify is the exact field that we want to store the value of 52 00:03:21,480 --> 00:03:24,290 X that we want to read from the user, from the console. 53 00:03:24,750 --> 00:03:29,060 So be one X and use an ampersand here. 54 00:03:29,100 --> 00:03:33,280 And also we are going to use the same for P dot y. 55 00:03:33,720 --> 00:03:34,740 So there you go. 56 00:03:34,740 --> 00:03:39,510 You simply are read the values of X and Y from the user. 57 00:03:39,750 --> 00:03:46,020 And finally, just to make sure that everything worked, OK, OK, because we just simply practice in 58 00:03:46,020 --> 00:03:46,790 some Hands-On. 59 00:03:46,980 --> 00:03:57,240 So print f print f the value of the point is and let's use here percentage and percentage just like 60 00:03:57,270 --> 00:03:59,340 you to show it in coordinates. 61 00:03:59,790 --> 00:04:06,170 And what also we want to specify is P1 and B1 dot y. 62 00:04:06,330 --> 00:04:09,710 That's how you do it right now. 63 00:04:09,750 --> 00:04:13,080 Let's build and run this program and see what happens. 64 00:04:13,110 --> 00:04:18,890 So answer Corradini, let's say five and let's say the Y coordinate would be seven. 65 00:04:19,320 --> 00:04:24,230 So the point is five seven and that's seems to be working. 66 00:04:24,710 --> 00:04:29,940 OK, now let's make an additional example of struct data. 67 00:04:29,940 --> 00:04:32,490 So struct to date, I love this example. 68 00:04:32,490 --> 00:04:37,590 I use it a lot of times when I explain this topic to you, my students. 69 00:04:37,890 --> 00:04:42,360 So you're probably going to see a couple of examples that we use. 70 00:04:42,360 --> 00:04:43,230 Struct date. 71 00:04:43,230 --> 00:04:45,990 So struct date and there you go. 72 00:04:45,990 --> 00:04:49,440 You specify now the fields inside of the struct. 73 00:04:49,440 --> 00:04:54,230 So each day int month and int year. 74 00:04:54,570 --> 00:04:58,980 All right, guys, once again, we did not create a variable. 75 00:04:58,980 --> 00:04:59,850 We just created. 76 00:04:59,930 --> 00:05:00,550 Template. 77 00:05:00,810 --> 00:05:06,380 You not what we are going to do is something very, very similar, we are going to modify this program 78 00:05:06,380 --> 00:05:06,910 a little bit. 79 00:05:07,130 --> 00:05:13,100 We are going to create, let's say, my my date one. 80 00:05:13,310 --> 00:05:20,010 OK, so my each one will be our variable and it will be of a struct daytime. 81 00:05:20,450 --> 00:05:24,350 OK, so that's how you create a structured variable. 82 00:05:24,500 --> 00:05:28,160 And in our case, the name is my date one and that's OK. 83 00:05:28,550 --> 00:05:34,550 You can also use herea the date of birth and whatever date of anniversary. 84 00:05:34,550 --> 00:05:37,430 Date of when you graduated or whatever. 85 00:05:37,670 --> 00:05:38,320 OK guys. 86 00:05:38,510 --> 00:05:45,610 So my date one is just graduate you eight date. 87 00:05:45,740 --> 00:05:48,620 This will be the date of your graduate graduation. 88 00:05:48,630 --> 00:05:49,770 OK, something like that. 89 00:05:50,030 --> 00:05:53,980 So now let's move on and print our answer. 90 00:05:53,990 --> 00:05:56,600 Let's say a day, OK? 91 00:05:56,600 --> 00:06:00,080 And today, when you graduated, answer what? 92 00:06:00,440 --> 00:06:03,620 Here we have enter month month. 93 00:06:04,070 --> 00:06:08,390 And also what we need to add is enter year. 94 00:06:08,540 --> 00:06:08,930 Right. 95 00:06:09,500 --> 00:06:16,790 And what we want to do is read these values and to store them inside of grade date today. 96 00:06:16,820 --> 00:06:24,800 OK, so the same we will do for month, for month and the same four year. 97 00:06:25,160 --> 00:06:33,320 OK, so that's simply how we read the values for each of the fields off the graduate date variable that 98 00:06:33,320 --> 00:06:34,960 we've just created. 99 00:06:35,030 --> 00:06:36,650 That's how you do it. 100 00:06:37,250 --> 00:06:49,160 And if we want to print the full date so we can say the day the graduation date is and let's use something 101 00:06:49,160 --> 00:06:50,030 like that. 102 00:06:50,170 --> 00:06:51,130 OK, I don't know. 103 00:06:51,140 --> 00:06:59,510 Let's use here a percentage, the percentage and percentage the and for the first one we will use let's 104 00:06:59,510 --> 00:07:06,320 see the year, the month, whatever you like in every country, these different formats. 105 00:07:06,320 --> 00:07:15,050 So we can specify first of all, the month, OK, so we will use graduate date grudge you what happened 106 00:07:15,050 --> 00:07:15,320 here. 107 00:07:15,320 --> 00:07:20,270 Graduate day to month, graduate date dot. 108 00:07:20,420 --> 00:07:23,600 They can graduate date dot. 109 00:07:23,620 --> 00:07:24,950 Yea that's it. 110 00:07:25,110 --> 00:07:30,230 And now we are going to build and run it and we are going to see what happens. 111 00:07:30,230 --> 00:07:34,970 So let's see the five month six in the year. 112 00:07:34,970 --> 00:07:36,110 Twenty twenty one. 113 00:07:36,500 --> 00:07:41,690 So the graduation date is on this date and that's freaking awesome guys. 114 00:07:42,020 --> 00:07:46,160 You see that the program works exactly as expected. 115 00:07:46,160 --> 00:07:53,180 And if we want to go over all the steps one by one, quickly, briefly summarizing, first of all, 116 00:07:53,180 --> 00:08:00,650 what we do, we create a structure template specifying the structure, name specifying the fields the 117 00:08:00,650 --> 00:08:05,690 structure is going to have in this case, it's day, month and year, all of them of type. 118 00:08:05,690 --> 00:08:12,890 And in this case, it's and to our X in why there is no reason why we could not have used something 119 00:08:12,890 --> 00:08:19,950 like that float and float y or even one or even one of them will be OK. 120 00:08:19,970 --> 00:08:28,770 There is no problem in mixing up different data types, different types of variables in a structure 121 00:08:28,790 --> 00:08:29,330 template. 122 00:08:29,330 --> 00:08:30,230 That's OK. 123 00:08:30,470 --> 00:08:38,510 And what we have done afterwards is that we created a new variable called graduate date of type structure 124 00:08:38,510 --> 00:08:46,610 date, read the values for the fields from the user and then simply printed out these values to the 125 00:08:46,610 --> 00:08:47,120 screen. 126 00:08:47,120 --> 00:08:55,610 So I think it's very hard not to understand this flow if you go exactly by the steps I've just mentioned. 127 00:08:56,240 --> 00:08:59,480 So I think that's enough for our initial practice. 128 00:08:59,480 --> 00:09:01,430 Guys, thank you so much for watching. 129 00:09:01,580 --> 00:09:02,790 Keep on practicing. 130 00:09:03,170 --> 00:09:06,650 These function are in these structures on your own. 131 00:09:06,830 --> 00:09:13,670 Run the code, make sure that everything works as expected and I will see you in the next video. 11886

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